Add print preview support (see issue #123)

Pass the `--enable-print-preview` command-line flag to enable. Currently only
supported on Windows and Linux.
This commit is contained in:
Ananyo Maiti
2019-07-17 14:47:27 -04:00
committed by Marshall Greenblatt
parent cf87c88b05
commit 1669c0afbd
49 changed files with 1098 additions and 1425 deletions

View File

@@ -6,6 +6,8 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/osr/browser_platform_delegate_osr.h"
#include "libcef/browser/web_contents_dialog_helper.h"
#include "libcef/common/extensions/extensions_util.h"
#include "base/logging.h"
#include "content/browser/renderer_host/render_widget_host_impl.h"
@@ -37,7 +39,13 @@ void CefBrowserPlatformDelegate::RenderViewCreated(
void CefBrowserPlatformDelegate::BrowserCreated(CefBrowserHostImpl* browser) {
DCHECK(!browser_);
DCHECK(browser);
browser_ = browser;
if (browser_->IsPrintPreviewSupported()) {
web_contents_dialog_helper_.reset(
new CefWebContentsDialogHelper(browser_->web_contents(), this));
}
}
void CefBrowserPlatformDelegate::NotifyBrowserCreated() {}
@@ -68,7 +76,7 @@ CefRefPtr<CefBrowserView> CefBrowserPlatformDelegate::GetBrowserView() const {
NOTREACHED();
return nullptr;
}
#endif // defined(USE_AURA)
#endif
void CefBrowserPlatformDelegate::PopupWebContentsCreated(
const CefBrowserSettings& settings,
@@ -209,6 +217,25 @@ void CefBrowserPlatformDelegate::AccessibilityLocationChangesReceived(
NOTREACHED();
}
gfx::Point CefBrowserPlatformDelegate::GetDialogPosition(
const gfx::Size& size) {
NOTREACHED();
return gfx::Point();
}
gfx::Size CefBrowserPlatformDelegate::GetMaximumDialogSize() {
NOTREACHED();
return gfx::Size();
}
base::RepeatingClosure CefBrowserPlatformDelegate::GetBoundsChangedCallback() {
if (web_contents_dialog_helper_) {
return web_contents_dialog_helper_->GetBoundsChangedCallback();
}
return base::RepeatingClosure();
}
// static
int CefBrowserPlatformDelegate::TranslateModifiers(uint32 cef_modifiers) {
int webkit_modifiers = 0;