mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add support for printing via CefBrowserHost::Print() and JavaScript window.print() (issue #505).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1479 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
#include "libcef/browser/devtools_delegate.h"
|
||||
#include "libcef/browser/media_capture_devices_dispatcher.h"
|
||||
#include "libcef/browser/navigate_params.h"
|
||||
#include "libcef/browser/printing/print_view_manager.h"
|
||||
#include "libcef/browser/render_widget_host_view_osr.h"
|
||||
#include "libcef/browser/request_context_impl.h"
|
||||
#include "libcef/browser/scheme_handler.h"
|
||||
@ -603,6 +604,18 @@ void CefBrowserHostImpl::StartDownload(const CefString& url) {
|
||||
manager->DownloadUrl(params.Pass());
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::Print() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (!web_contents_)
|
||||
return;
|
||||
printing::PrintViewManager::FromWebContents(
|
||||
web_contents_.get())->PrintNow();
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT,
|
||||
base::Bind(&CefBrowserHostImpl::Print, this));
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserHostImpl::SetMouseCursorChangeDisabled(bool disabled) {
|
||||
base::AutoLock lock_scope(state_lock_);
|
||||
mouse_cursor_change_disabled_ = disabled;
|
||||
@ -2114,6 +2127,8 @@ CefBrowserHostImpl::CefBrowserHostImpl(
|
||||
CefString(), CefString(),
|
||||
CefFrameHostImpl::kInvalidFrameId);
|
||||
|
||||
printing::PrintViewManager::CreateForWebContents(web_contents_.get());
|
||||
|
||||
// Make sure RenderViewCreated is called at least one time.
|
||||
RenderViewCreated(web_contents->GetRenderViewHost());
|
||||
|
||||
|
Reference in New Issue
Block a user