mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Move GetPrintHandler to CefClient (see issue #2196)
This new location is preferred because we now know the associated CefBrowser for all CefPrintHandler callbacks.
This commit is contained in:
@@ -6,10 +6,6 @@
|
||||
|
||||
#include "tests/cefclient/browser/client_browser.h"
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "tests/cefclient/browser/print_handler_gtk.h"
|
||||
#endif
|
||||
|
||||
namespace client {
|
||||
|
||||
// static
|
||||
@@ -17,13 +13,4 @@ void ClientAppBrowser::CreateDelegates(DelegateSet& delegates) {
|
||||
browser::CreateDelegates(delegates);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefPrintHandler> ClientAppBrowser::CreatePrintHandler() {
|
||||
#if defined(OS_LINUX)
|
||||
return new ClientPrintHandlerGtk();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace client
|
||||
|
@@ -259,6 +259,7 @@ ClientHandler::ClientHandler(Delegate* delegate,
|
||||
#if defined(OS_LINUX)
|
||||
// Provide the GTK-based dialog implementation on Linux.
|
||||
dialog_handler_ = new ClientDialogHandlerGtk();
|
||||
print_handler_ = new ClientPrintHandlerGtk();
|
||||
#endif
|
||||
|
||||
resource_manager_ = new CefResourceManager();
|
||||
|
@@ -18,6 +18,7 @@
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
#include "tests/cefclient/browser/dialog_handler_gtk.h"
|
||||
#include "tests/cefclient/browser/print_handler_gtk.h"
|
||||
#endif
|
||||
|
||||
namespace client {
|
||||
@@ -122,6 +123,9 @@ class ClientHandler : public CefClient,
|
||||
CefRefPtr<CefJSDialogHandler> GetJSDialogHandler() OVERRIDE {
|
||||
return dialog_handler_;
|
||||
}
|
||||
CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE {
|
||||
return print_handler_;
|
||||
}
|
||||
#endif
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
@@ -372,6 +376,7 @@ class ClientHandler : public CefClient,
|
||||
#if defined(OS_LINUX)
|
||||
// Custom dialog handler for GTK.
|
||||
CefRefPtr<ClientDialogHandlerGtk> dialog_handler_;
|
||||
CefRefPtr<ClientPrintHandlerGtk> print_handler_;
|
||||
#endif
|
||||
|
||||
// Handles the browser side of query routing. The renderer side is handled
|
||||
|
@@ -637,7 +637,8 @@ void ClientPrintHandlerGtk::OnPrintReset(CefRefPtr<CefBrowser> browser) {
|
||||
print_handler_map_.erase(it);
|
||||
}
|
||||
|
||||
CefSize ClientPrintHandlerGtk::GetPdfPaperSize(int device_units_per_inch) {
|
||||
CefSize ClientPrintHandlerGtk::GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
|
||||
int device_units_per_inch) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
ScopedGdkThreadsEnter scoped_gdk_threads;
|
||||
|
@@ -31,7 +31,8 @@ class ClientPrintHandlerGtk : public CefPrintHandler {
|
||||
const CefString& pdf_file_path,
|
||||
CefRefPtr<CefPrintJobCallback> callback) OVERRIDE;
|
||||
void OnPrintReset(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
CefSize GetPdfPaperSize(int device_units_per_inch) OVERRIDE;
|
||||
CefSize GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
|
||||
int device_units_per_inch) OVERRIDE;
|
||||
|
||||
private:
|
||||
// Print handler.
|
||||
|
@@ -119,11 +119,6 @@ void ClientAppBrowser::CreateDelegates(DelegateSet& delegates) {
|
||||
::CreateBrowserDelegates(delegates);
|
||||
}
|
||||
|
||||
// static
|
||||
CefRefPtr<CefPrintHandler> ClientAppBrowser::CreatePrintHandler() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientAppRenderer::CreateDelegates(DelegateSet& delegates) {
|
||||
::CreateRenderDelegates(delegates);
|
||||
|
@@ -67,8 +67,6 @@ void ClientAppBrowser::GetCookieableSchemes(std::vector<CefString>& schemes,
|
||||
}
|
||||
|
||||
void ClientAppBrowser::OnContextInitialized() {
|
||||
print_handler_ = CreatePrintHandler();
|
||||
|
||||
DelegateSet::iterator it = delegates_.begin();
|
||||
for (; it != delegates_.end(); ++it)
|
||||
(*it)->OnContextInitialized(this);
|
||||
|
@@ -40,10 +40,6 @@ class ClientAppBrowser : public ClientApp, public CefBrowserProcessHandler {
|
||||
// client_app_delegates_browser.cc
|
||||
static void CreateDelegates(DelegateSet& delegates);
|
||||
|
||||
// Create the Linux print handler. Implemented by cefclient in
|
||||
// client_app_delegates_browser.cc
|
||||
static CefRefPtr<CefPrintHandler> CreatePrintHandler();
|
||||
|
||||
// CefApp methods.
|
||||
void OnBeforeCommandLineProcessing(
|
||||
const CefString& process_type,
|
||||
@@ -58,16 +54,11 @@ class ClientAppBrowser : public ClientApp, public CefBrowserProcessHandler {
|
||||
void OnContextInitialized() OVERRIDE;
|
||||
void OnBeforeChildProcessLaunch(
|
||||
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
|
||||
CefRefPtr<CefPrintHandler> GetPrintHandler() OVERRIDE {
|
||||
return print_handler_;
|
||||
}
|
||||
void OnScheduleMessagePumpWork(int64 delay) OVERRIDE;
|
||||
|
||||
// Set of supported Delegates.
|
||||
DelegateSet delegates_;
|
||||
|
||||
CefRefPtr<CefPrintHandler> print_handler_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientAppBrowser);
|
||||
DISALLOW_COPY_AND_ASSIGN(ClientAppBrowser);
|
||||
};
|
||||
|
Reference in New Issue
Block a user