Add CefPrintHandler::OnPrintStart callback (issue #1736)

This commit is contained in:
Marshall Greenblatt
2015-10-12 16:45:14 -04:00
parent f7d9457c20
commit 1f21fe5412
13 changed files with 143 additions and 9 deletions

View File

@@ -8,6 +8,8 @@
#include <string>
#include <vector>
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/print_settings_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/content_client.h"
@@ -134,6 +136,35 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize(
return size;
}
// static
void CefPrintDialogLinux::OnPrintStart(int render_process_id,
int render_routing_id) {
if (!CEF_CURRENTLY_ON(CEF_UIT)) {
CEF_POST_TASK(CEF_UIT,
base::Bind(&CefPrintDialogLinux::OnPrintStart,
render_process_id, render_routing_id));
return;
}
CefRefPtr<CefApp> app = CefContentClient::Get()->application();
if (!app.get())
return;
CefRefPtr<CefBrowserProcessHandler> browser_handler =
app->GetBrowserProcessHandler();
if (!browser_handler.get())
return;
CefRefPtr<CefPrintHandler> handler = browser_handler->GetPrintHandler();
if (!handler.get())
return;
CefRefPtr<CefBrowserHostImpl> browser =
extensions::GetOwnerBrowserForView(render_process_id, render_routing_id);
if (browser.get())
handler->OnPrintStart(browser.get());
}
CefPrintDialogLinux::CefPrintDialogLinux(PrintingContextLinux* context)
: context_(context) {
}