Update to Chromium revision 92d77538 (#369907)

This commit is contained in:
Marshall Greenblatt 2016-02-02 16:32:44 -05:00 committed by Marshall Greenblatt
parent d6fa9ed3e3
commit 70ab57ab23
25 changed files with 598 additions and 233 deletions

View File

@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'd7d5682a0953188e49a31505303665ff916c1080',
'chromium_checkout': '92d77538a86529ca35f9220bd3cd512cbea1f086',
}

View File

@ -1524,7 +1524,7 @@
},
],
'conditions': [
['os_posix==1 and OS!="mac" and OS!="android" and gcc_version>=46', {
['os_posix==1 and OS!="mac" and OS!="android"', {
'target_defaults': {
# Disable warnings about c++0x compatibility, as some names (such
# as nullptr) conflict with upcoming c++0x types.

View File

@ -1338,7 +1338,7 @@ CefRefPtr<CefFrame> CefBrowserHostImpl::GetFrameForRequest(
if (!info)
return nullptr;
return GetOrCreateFrame(info->GetRenderFrameID(),
info->GetParentRenderFrameID(),
CefFrameHostImpl::kUnspecifiedFrameId,
info->IsMainFrame(),
base::string16(),
GURL());

View File

@ -314,8 +314,10 @@ class Delegate : public InternalHandlerDelegate {
return false;
}
if (resource_id == IDR_WEBUI_CSS_TEXT_DEFAULTS) {
const std::string& css = webui::GetWebUiCssTextDefaults();
if (resource_id == IDR_WEBUI_CSS_TEXT_DEFAULTS ||
resource_id == IDR_WEBUI_CSS_TEXT_DEFAULTS_MD) {
const std::string& css = resource_id == IDR_WEBUI_CSS_TEXT_DEFAULTS ?
webui::GetWebUiCssTextDefaults() : webui::GetWebUiCssTextDefaultsMd();
DCHECK(!css.empty());
action->mime_type = "text/css";
action->stream = CefStreamReader::CreateForData(

View File

@ -38,10 +38,6 @@
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(OS_WIN)
#include "base/win/metro.h"
#endif
#if !defined(DISABLE_NACL)
#include "components/nacl/common/nacl_constants.h"
#endif
@ -309,13 +305,6 @@ void CefPluginInfoMessageFilter::Context::DecidePluginStatus(
const WebPluginInfo& plugin,
const PluginMetadata* plugin_metadata,
CefViewHostMsg_GetPluginInfo_Status* status) const {
#if defined(OS_WIN)
if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI &&
base::win::IsMetroProcess()) {
*status = CefViewHostMsg_GetPluginInfo_Status::kNPAPINotSupported;
return;
}
#endif
if (plugin.type == WebPluginInfo::PLUGIN_TYPE_NPAPI) {
CHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
// NPAPI plugins are not supported inside <webview> guests.

View File

@ -80,14 +80,23 @@ CefResourceDispatcherHostDelegate::~CefResourceDispatcherHostDelegate() {
bool CefResourceDispatcherHostDelegate::HandleExternalProtocol(
const GURL& url,
int child_id,
int route_id,
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) {
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForView(child_id, route_id);
if (browser.get())
browser->HandleExternalProtocol(url);
if (CEF_CURRENTLY_ON_UIT()) {
content::WebContents* web_contents = web_contents_getter.Run();
CefRefPtr<CefBrowserHostImpl> browser =
CefBrowserHostImpl::GetBrowserForContents(web_contents);
if (browser.get())
browser->HandleExternalProtocol(url);
} else {
CEF_POST_TASK(CEF_UIT,
base::Bind(base::IgnoreResult(&CefResourceDispatcherHostDelegate::
HandleExternalProtocol),
base::Unretained(this), url, child_id, web_contents_getter,
is_main_frame, page_transition, has_user_gesture));
}
return false;
}

View File

@ -21,12 +21,14 @@ class CefResourceDispatcherHostDelegate
~CefResourceDispatcherHostDelegate() override;
// ResourceDispatcherHostDelegate methods.
bool HandleExternalProtocol(const GURL& url,
int child_id,
int route_id,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
bool HandleExternalProtocol(
const GURL& url,
int child_id,
const content::ResourceRequestInfo::WebContentsGetter&
web_contents_getter,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture) override;
bool ShouldInterceptResourceAsStream(net::URLRequest* request,
const base::FilePath& plugin_path,
const std::string& mime_type,

View File

@ -770,10 +770,8 @@ void CefRequestImpl::Get(net::URLFetcher& fetcher,
}
}
if (!first_party_for_cookies_.empty()) {
fetcher.SetFirstPartyForCookies(
GURL(first_party_for_cookies_.ToString()));
}
if (!first_party_for_cookies_.empty())
fetcher.SetInitiatorURL(GURL(first_party_for_cookies_.ToString()));
if (flags_ & UR_FLAG_NO_RETRY_ON_5XX)
fetcher.SetAutomaticallyRetryOn5xx(false);

View File

@ -41,9 +41,6 @@ patches = [
},
{
# Enable popups in offscreen rendering on OS X.
#
# Fix dismissal of select popups on blur with OSR.
# https://codereview.chromium.org/1565053002
'name': 'webkit_popups',
'path': '../third_party/WebKit/',
},
@ -179,6 +176,10 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issue/1478
# Fix printing of PDF documents via PrintToPDF.
# https://bitbucket.org/chromiumembedded/cef/issues/1565
# Fix header/footer scaling on Linux.
# https://code.google.com/p/chromium/issues/detail?id=583527
# Revert ENABLE_PRINT_PREVIEW changes from the following changeset.
# https://codereview.chromium.org/1556463003
'name': 'print_header_footer_1478_1565',
'path': '../components/',
},

View File

@ -1,8 +1,8 @@
diff --git web_contents_impl.cc web_contents_impl.cc
index 88f58a7..9e454db 100644
index ccadfb2..b70b8e4 100644
--- web_contents_impl.cc
+++ web_contents_impl.cc
@@ -1366,32 +1366,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
@@ -1388,32 +1388,40 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) {
main_frame_widget_routing_id);
frame_tree_.root()->SetFrameName(params.main_frame_name);
@ -62,7 +62,7 @@ index 88f58a7..9e454db 100644
CHECK(render_view_host_delegate_view_);
CHECK(view_.get());
@@ -1806,11 +1814,14 @@ void WebContentsImpl::CreateNewWindow(
@@ -1835,11 +1843,14 @@ void WebContentsImpl::CreateNewWindow(
static_cast<SessionStorageNamespaceImpl*>(session_storage_namespace);
CHECK(session_storage_namespace_impl->IsFromContext(dom_storage_context));
@ -78,7 +78,7 @@ index 88f58a7..9e454db 100644
if (route_id != MSG_ROUTING_NONE &&
!RenderViewHost::FromID(render_process_id, route_id)) {
// If the embedder didn't create a WebContents for this route, we need to
@@ -1831,6 +1842,8 @@ void WebContentsImpl::CreateNewWindow(
@@ -1860,6 +1871,8 @@ void WebContentsImpl::CreateNewWindow(
create_params.opener_render_process_id = render_process_id;
create_params.opener_render_frame_id = params.opener_render_frame_id;
create_params.opener_suppressed = params.opener_suppressed;

View File

@ -1,5 +1,5 @@
diff --git common.gypi common.gypi
index 577a95c..4c1cbfe 100644
index 514b129..036fe51 100644
--- common.gypi
+++ common.gypi
@@ -9,6 +9,9 @@
@ -12,7 +12,7 @@ index 577a95c..4c1cbfe 100644
# Putting a variables dict inside another variables dict looks kind of
# weird. This is done so that 'host_arch', 'chromeos', etc are defined as
# variables within the outer variables dict here. This is necessary
@@ -92,7 +95,10 @@
@@ -95,7 +98,10 @@
# depending on the packages installed on the local machine. Set this
# to 0 to build against locally installed headers and libraries (e.g.
# if packaging for a linux distro)

View File

@ -1,8 +1,8 @@
diff --git ui/browser.cc ui/browser.cc
index 1f41d7c..7ebcc2d 100644
index 717381d..35f791b 100644
--- ui/browser.cc
+++ ui/browser.cc
@@ -1708,7 +1708,9 @@ bool Browser::ShouldCreateWebContents(
@@ -1707,7 +1707,9 @@ bool Browser::ShouldCreateWebContents(
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
@ -14,10 +14,10 @@ index 1f41d7c..7ebcc2d 100644
// If a BackgroundContents is created, suppress the normal WebContents.
return !MaybeCreateBackgroundContents(
diff --git ui/browser.h ui/browser.h
index e3f6b883..1861b68 100644
index 13ec6b4..6e8fffa 100644
--- ui/browser.h
+++ ui/browser.h
@@ -598,7 +598,9 @@ class Browser : public TabStripModelObserver,
@@ -599,7 +599,9 @@ class Browser : public TabStripModelObserver,
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@ -1,8 +1,8 @@
diff --git content/browser/compositor/gpu_process_transport_factory.cc content/browser/compositor/gpu_process_transport_factory.cc
index 51099ca..af38404 100644
index 874debf..ba26bdf 100644
--- content/browser/compositor/gpu_process_transport_factory.cc
+++ content/browser/compositor/gpu_process_transport_factory.cc
@@ -138,6 +138,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
@@ -137,6 +137,13 @@ GpuProcessTransportFactory::CreateOffscreenCommandBufferContext() {
scoped_ptr<cc::SoftwareOutputDevice>
GpuProcessTransportFactory::CreateSoftwareOutputDevice(
ui::Compositor* compositor) {

View File

@ -1,73 +1,60 @@
diff --git public/renderer/content_renderer_client.cc public/renderer/content_renderer_client.cc
index 32004d1..ccd1f58 100644
index 3d0316f..ccd1f58 100644
--- public/renderer/content_renderer_client.cc
+++ public/renderer/content_renderer_client.cc
@@ -98,6 +98,18 @@ bool ContentRendererClient::AllowPopup() {
@@ -98,7 +98,6 @@ bool ContentRendererClient::AllowPopup() {
return false;
}
+bool ContentRendererClient::HandleNavigation(
+ RenderFrame* render_frame,
+ bool is_content_initiated,
+ int opener_id,
+ blink::WebFrame* frame,
+ const blink::WebURLRequest& request,
+ blink::WebNavigationType type,
+ blink::WebNavigationPolicy default_policy,
+ bool is_redirect) {
+ return false;
+}
+
-#ifdef OS_ANDROID
bool ContentRendererClient::HandleNavigation(
RenderFrame* render_frame,
bool is_content_initiated,
@@ -110,7 +109,6 @@ bool ContentRendererClient::HandleNavigation(
bool is_redirect) {
return false;
}
-#endif
bool ContentRendererClient::ShouldFork(blink::WebLocalFrame* frame,
const GURL& url,
const std::string& http_method,
diff --git public/renderer/content_renderer_client.h public/renderer/content_renderer_client.h
index fd2f3af..40cca1d 100644
index 45686b5..18548a0 100644
--- public/renderer/content_renderer_client.h
+++ public/renderer/content_renderer_client.h
@@ -18,6 +18,8 @@
#include "base/strings/string16.h"
#include "content/public/common/content_client.h"
#include "third_party/WebKit/public/platform/WebPageVisibilityState.h"
+#include "third_party/WebKit/public/web/WebNavigationPolicy.h"
+#include "third_party/WebKit/public/web/WebNavigationType.h"
#include "ui/base/page_transition_types.h"
#include "v8/include/v8.h"
@@ -191,6 +193,17 @@ class CONTENT_EXPORT ContentRendererClient {
@@ -194,7 +194,6 @@ class CONTENT_EXPORT ContentRendererClient {
// Returns true if a popup window should be allowed.
virtual bool AllowPopup();
+
+ // Returns true if the navigation was handled by the embedder and should be
+ // ignored by WebKit. This method is used by CEF and android_webview.
+ virtual bool HandleNavigation(RenderFrame* render_frame,
+ bool is_content_initiated,
+ int opener_id,
+ blink::WebFrame* frame,
+ const blink::WebURLRequest& request,
+ blink::WebNavigationType type,
+ blink::WebNavigationPolicy default_policy,
+ bool is_redirect);
-#ifdef OS_ANDROID
// TODO(sgurun) This callback is deprecated and will be removed as soon
// as android webview completes implementation of a resource throttle based
// shouldoverrideurl implementation. See crbug.com/325351
@@ -209,7 +208,6 @@ class CONTENT_EXPORT ContentRendererClient {
blink::WebNavigationType type,
blink::WebNavigationPolicy default_policy,
bool is_redirect);
-#endif
// Returns true if we should fork a new process for the given navigation.
// If |send_referrer| is set to false (which is the default), no referrer
diff --git renderer/render_frame_impl.cc renderer/render_frame_impl.cc
index 9ea32c4..adb478d 100644
index 9b199d3..1a8b6fa 100644
--- renderer/render_frame_impl.cc
+++ renderer/render_frame_impl.cc
@@ -4609,6 +4609,14 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
@@ -4684,7 +4684,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
(pending_navigation_params_ &&
!pending_navigation_params_->request_params.redirects.empty());
+ if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
+ GetContentClient()->renderer()->HandleNavigation(
+ this, is_content_initiated, render_view_->opener_id_, frame_,
+ info.urlRequest, info.navigationType, info.defaultPolicy,
+ is_redirect)) {
+ return blink::WebNavigationPolicyIgnore;
+ }
+
-#ifdef OS_ANDROID
// The handlenavigation API is deprecated and will be removed once
// crbug.com/325351 is resolved.
if (info.urlRequest.url() != GURL(kSwappedOutURL) &&
@@ -4694,7 +4693,6 @@ WebNavigationPolicy RenderFrameImpl::decidePolicyForNavigation(
is_redirect)) {
return blink::WebNavigationPolicyIgnore;
}
-#endif
Referrer referrer(
RenderViewImpl::GetReferrerFromRequest(frame_, info.urlRequest));

View File

@ -1,5 +1,5 @@
diff --git resource_ids resource_ids
index 93949e3..5552faf 100644
index c1f41e0..5ef46f2 100644
--- resource_ids
+++ resource_ids
@@ -14,6 +14,12 @@

View File

@ -1,8 +1,8 @@
diff --git hwnd_message_handler.cc hwnd_message_handler.cc
index 86ed8f8..8fb17b5 100644
index 0cacffe..847ce2b 100644
--- hwnd_message_handler.cc
+++ hwnd_message_handler.cc
@@ -2382,8 +2382,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
@@ -2387,8 +2387,12 @@ LRESULT HWNDMessageHandler::HandleMouseEventInternal(UINT message,
active_mouse_tracking_flags_ = 0;
} else if (event.type() == ui::ET_MOUSEWHEEL) {
// Reroute the mouse wheel to the window under the pointer if applicable.

View File

@ -1,10 +1,10 @@
diff --git message_loop.cc message_loop.cc
index cfa86d9..6775c3d 100644
index e84765a..560bd39 100644
--- message_loop.cc
+++ message_loop.cc
@@ -137,12 +137,6 @@ MessageLoop::~MessageLoop() {
// bound to a thread.
DCHECK(current() == this || !current());
@@ -139,12 +139,6 @@ MessageLoop::~MessageLoop() {
// may be current.
DCHECK((pump_ && current() == this) || (!pump_ && current() != this));
- // iOS just attaches to the loop, it doesn't Run it.
- // TODO(stuartmorgan): Consider wiring up a Detach().

View File

@ -1,8 +1,8 @@
diff --git url_request.h url_request.h
index ea6a54d..2c98007 100644
index 1a17470..bf51358 100644
--- url_request.h
+++ url_request.h
@@ -652,10 +652,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
@@ -674,10 +674,10 @@ class NET_EXPORT URLRequest : NON_EXPORTED_BASE(public base::NonThreadSafe),
// or after the response headers are received.
void GetConnectionAttempts(ConnectionAttempts* out) const;

View File

@ -1,5 +1,5 @@
diff --git fpdfsdk/src/fpdfview.cpp fpdfsdk/src/fpdfview.cpp
index 041adda..407cbba 100644
index a6c1420..88c1b97 100644
--- fpdfsdk/src/fpdfview.cpp
+++ fpdfsdk/src/fpdfview.cpp
@@ -14,6 +14,7 @@
@ -10,8 +10,8 @@ index 041adda..407cbba 100644
#include "public/fpdf_ext.h"
#include "public/fpdf_progressive.h"
#include "third_party/base/numerics/safe_conversions_impl.h"
@@ -116,6 +117,7 @@ DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig(
DLLEXPORT void STDCALL FPDF_DestroyLibrary() {
@@ -258,6 +259,7 @@ DLLEXPORT void STDCALL FPDF_DestroyLibrary() {
#endif // PDF_ENABLE_XFA
CPDF_ModuleMgr::Destroy();
CFX_GEModule::Destroy();
+ FXJS_Release();

View File

@ -1,5 +1,5 @@
diff --git public/common/common_param_traits_macros.h public/common/common_param_traits_macros.h
index e836e1b..f261e0d 100644
index a9811c4..a43f9d1 100644
--- public/common/common_param_traits_macros.h
+++ public/common/common_param_traits_macros.h
@@ -193,6 +193,7 @@ IPC_STRUCT_TRAITS_BEGIN(content::WebPreferences)
@ -11,7 +11,7 @@ index e836e1b..f261e0d 100644
IPC_STRUCT_TRAITS_MEMBER(navigate_on_drag_drop)
IPC_STRUCT_TRAITS_MEMBER(spatial_navigation_enabled)
diff --git public/common/web_preferences.cc public/common/web_preferences.cc
index c887f9a8..873ed91 100644
index 4a83a70..98781c0 100644
--- public/common/web_preferences.cc
+++ public/common/web_preferences.cc
@@ -171,6 +171,7 @@ WebPreferences::WebPreferences()
@ -20,10 +20,10 @@ index c887f9a8..873ed91 100644
navigate_on_drag_drop(true),
+ base_background_color(0xFFFFFFFF), // Color::white
v8_cache_options(V8_CACHE_OPTIONS_DEFAULT),
slimming_paint_v2_enabled(false),
cookie_enabled(true),
pepper_accelerated_video_decode_enabled(false),
diff --git public/common/web_preferences.h public/common/web_preferences.h
index fc1ee14..5094abb 100644
index de5a3c5..afdf03f 100644
--- public/common/web_preferences.h
+++ public/common/web_preferences.h
@@ -172,6 +172,7 @@ struct CONTENT_EXPORT WebPreferences {
@ -32,13 +32,13 @@ index fc1ee14..5094abb 100644
bool navigate_on_drag_drop;
+ uint32_t base_background_color;
V8CacheOptions v8_cache_options;
bool slimming_paint_v2_enabled;
// This flags corresponds to a Page's Settings' setCookieEnabled state. It
diff --git renderer/render_view_impl.cc renderer/render_view_impl.cc
index 00c278e..4435b20 100644
index 8e6b887..77ef5ad 100644
--- renderer/render_view_impl.cc
+++ renderer/render_view_impl.cc
@@ -939,6 +939,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
@@ -938,6 +938,8 @@ void RenderView::ApplyWebPreferences(const WebPreferences& prefs,
settings->setCookieEnabled(prefs.cookie_enabled);
settings->setNavigateOnDragDrop(prefs.navigate_on_drag_drop);

View File

@ -1,8 +1,145 @@
diff --git printing/common/print_messages.cc printing/common/print_messages.cc
index c3469fc..9fc71ac 100644
--- printing/common/print_messages.cc
+++ printing/common/print_messages.cc
@@ -95,7 +95,6 @@ void PrintMsg_PrintPages_Params::Reset() {
pages = std::vector<int>();
}
-#if defined(ENABLE_PRINT_PREVIEW)
PrintHostMsg_RequestPrintPreview_Params::
PrintHostMsg_RequestPrintPreview_Params()
: is_modifiable(false),
@@ -117,4 +116,3 @@ PrintHostMsg_SetOptionsFromDocument_Params::
PrintHostMsg_SetOptionsFromDocument_Params::
~PrintHostMsg_SetOptionsFromDocument_Params() {
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
diff --git printing/common/print_messages.h printing/common/print_messages.h
index 372097f..ae8a227 100644
--- printing/common/print_messages.h
+++ printing/common/print_messages.h
@@ -70,7 +70,6 @@ struct PrintMsg_PrintPages_Params {
std::vector<int> pages;
};
-#if defined(ENABLE_PRINT_PREVIEW)
struct PrintHostMsg_RequestPrintPreview_Params {
PrintHostMsg_RequestPrintPreview_Params();
~PrintHostMsg_RequestPrintPreview_Params();
@@ -89,7 +88,6 @@ struct PrintHostMsg_SetOptionsFromDocument_Params {
printing::DuplexMode duplex;
printing::PageRanges page_ranges;
};
-#endif // defined(ENABLE_PRINT_PREVIEW)
#endif // COMPONENTS_PRINTING_COMMON_PRINT_MESSAGES_H_
@@ -182,7 +180,6 @@ IPC_STRUCT_TRAITS_BEGIN(printing::PageRange)
IPC_STRUCT_TRAITS_MEMBER(to)
IPC_STRUCT_TRAITS_END()
-#if defined(ENABLE_PRINT_PREVIEW)
IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_RequestPrintPreview_Params)
IPC_STRUCT_TRAITS_MEMBER(is_modifiable)
IPC_STRUCT_TRAITS_MEMBER(webnode_only)
@@ -203,7 +200,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintHostMsg_SetOptionsFromDocument_Params)
// Specifies page range to be printed.
IPC_STRUCT_TRAITS_MEMBER(page_ranges)
IPC_STRUCT_TRAITS_END()
-#endif // defined(ENABLE_PRINT_PREVIEW)
IPC_STRUCT_TRAITS_BEGIN(printing::PageSizeMargins)
IPC_STRUCT_TRAITS_MEMBER(content_width)
@@ -223,7 +219,6 @@ IPC_STRUCT_TRAITS_BEGIN(PrintMsg_PrintPages_Params)
IPC_STRUCT_TRAITS_MEMBER(pages)
IPC_STRUCT_TRAITS_END()
-#if defined(ENABLE_PRINT_PREVIEW)
// Parameters to describe a rendered document.
IPC_STRUCT_BEGIN(PrintHostMsg_DidPreviewDocument_Params)
// A shared memory handle to metafile data.
@@ -277,7 +272,6 @@ IPC_STRUCT_BEGIN(PrintHostMsg_DidGetPreviewPageCount_Params)
// Indicates whether the existing preview data needs to be cleared or not.
IPC_STRUCT_MEMBER(bool, clear_preview_data)
IPC_STRUCT_END()
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Parameters to describe a rendered page.
IPC_STRUCT_BEGIN(PrintHostMsg_DidPrintPage_Params)
@@ -315,22 +309,20 @@ IPC_STRUCT_END()
// Messages sent from the browser to the renderer.
-#if defined(ENABLE_PRINT_PREVIEW)
// Tells the render view to initiate print preview for the entire document.
IPC_MESSAGE_ROUTED1(PrintMsg_InitiatePrintPreview, bool /* selection_only */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Tells the render frame to initiate printing or print preview for a particular
// node, depending on which mode the render frame is in.
IPC_MESSAGE_ROUTED0(PrintMsg_PrintNodeUnderContextMenu)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
+#if defined(ENABLE_BASIC_PRINTING)
// Tells the renderer to print the print preview tab's PDF plugin without
// showing the print dialog. (This is the final step in the print preview
// workflow.)
IPC_MESSAGE_ROUTED1(PrintMsg_PrintForPrintPreview,
base::DictionaryValue /* settings */)
-#endif // defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
+#endif // defined(ENABLE_BASIC_PRINTING)
#if defined(ENABLE_BASIC_PRINTING)
// Tells the render view to switch the CSS to print media type, renders every
@@ -349,13 +341,11 @@ IPC_MESSAGE_ROUTED1(PrintMsg_PrintingDone,
IPC_MESSAGE_ROUTED1(PrintMsg_SetScriptedPrintingBlocked,
bool /* blocked */)
-#if defined(ENABLE_PRINT_PREVIEW)
// Tells the render view to switch the CSS to print media type, renders every
// requested pages for print preview using the given |settings|. This gets
// called multiple times as the user updates settings.
IPC_MESSAGE_ROUTED1(PrintMsg_PrintPreview,
base::DictionaryValue /* settings */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Messages sent from the renderer to the browser.
@@ -423,7 +413,6 @@ IPC_MESSAGE_CONTROL2(PrintHostMsg_TempFileForPrintingWritten,
int /* fd in browser */) // Used only by Chrome OS.
#endif // defined(OS_ANDROID)
-#if defined(ENABLE_PRINT_PREVIEW)
// Asks the browser to do print preview.
IPC_MESSAGE_ROUTED1(PrintHostMsg_RequestPrintPreview,
PrintHostMsg_RequestPrintPreview_Params /* params */)
@@ -457,7 +446,6 @@ IPC_SYNC_MESSAGE_ROUTED2_1(PrintHostMsg_CheckForCancel,
// The memory handle in this message is already valid in the browser process.
IPC_MESSAGE_ROUTED1(PrintHostMsg_MetafileReadyForPrinting,
PrintHostMsg_DidPreviewDocument_Params /* params */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
// This is sent when there are invalid printer settings.
IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
@@ -466,7 +454,6 @@ IPC_MESSAGE_ROUTED0(PrintHostMsg_ShowInvalidPrinterSettingsError)
IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintingFailed,
int /* document cookie */)
-#if defined(ENABLE_PRINT_PREVIEW)
// Tell the browser print preview failed.
IPC_MESSAGE_ROUTED1(PrintHostMsg_PrintPreviewFailed,
int /* document cookie */)
@@ -493,4 +480,3 @@ IPC_MESSAGE_ROUTED1(PrintHostMsg_ShowScriptedPrintPreview,
// Notify the browser to set print presets based on source PDF document.
IPC_MESSAGE_ROUTED1(PrintHostMsg_SetOptionsFromDocument,
PrintHostMsg_SetOptionsFromDocument_Params /* params */)
-#endif // defined(ENABLE_PRINT_PREVIEW)
diff --git printing/renderer/print_web_view_helper.cc printing/renderer/print_web_view_helper.cc
index c09ad6a..2a92296 100644
index ff97954..c93dabf 100644
--- printing/renderer/print_web_view_helper.cc
+++ printing/renderer/print_web_view_helper.cc
@@ -79,6 +79,9 @@ const double kMinDpi = 1.0;
@@ -80,6 +80,9 @@ const double kMinDpi = 1.0;
#if defined(ENABLE_PRINT_PREVIEW)
bool g_is_preview_enabled = true;
@ -12,7 +149,7 @@ index c09ad6a..2a92296 100644
const char kPageLoadScriptFormat[] =
"document.open(); document.write(%s); document.close();";
@@ -93,9 +96,6 @@ void ExecuteScript(blink::WebFrame* frame,
@@ -94,9 +97,6 @@ void ExecuteScript(blink::WebFrame* frame,
std::string script = base::StringPrintf(script_format, json.c_str());
frame->executeScript(blink::WebString(base::UTF8ToUTF16(script)));
}
@ -22,7 +159,39 @@ index c09ad6a..2a92296 100644
int GetDPI(const PrintMsg_Print_Params* print_params) {
#if defined(OS_MACOSX)
@@ -486,7 +486,6 @@ blink::WebView* FrameReference::view() {
@@ -306,7 +306,6 @@ bool PrintingNodeOrPdfFrame(const blink::WebLocalFrame* frame,
return plugin && plugin->supportsPaginatedPrint();
}
-#if defined(ENABLE_PRINT_PREVIEW)
// Returns true if the current destination printer is PRINT_TO_PDF.
bool IsPrintToPdfRequested(const base::DictionaryValue& job_settings) {
bool print_to_pdf = false;
@@ -328,7 +327,6 @@ bool PrintingFrameHasPageSizeStyle(blink::WebFrame* frame,
}
return frame_has_custom_page_size_style;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Disable scaling when either:
// - The PDF specifies disabling scaling.
@@ -375,7 +373,6 @@ MarginType GetMarginsForPdf(blink::WebLocalFrame* frame,
}
#endif
-#if defined(ENABLE_PRINT_PREVIEW)
bool FitToPageEnabled(const base::DictionaryValue& job_settings) {
bool fit_to_paper_size = false;
if (!job_settings.GetBoolean(kSettingFitToPageEnabled, &fit_to_paper_size)) {
@@ -417,7 +414,6 @@ blink::WebPrintScalingOption GetPrintScalingOption(
}
return blink::WebPrintScalingOptionFitToPrintableArea;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
PrintMsg_Print_Params CalculatePrintParamsForCss(
blink::WebFrame* frame,
@@ -501,7 +497,6 @@ blink::WebView* FrameReference::view() {
return view_;
}
@ -30,7 +199,7 @@ index c09ad6a..2a92296 100644
// static - Not anonymous so that platform implementations can use it.
void PrintWebViewHelper::PrintHeaderAndFooter(
blink::WebCanvas* canvas,
@@ -542,7 +541,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
@@ -557,7 +552,6 @@ void PrintWebViewHelper::PrintHeaderAndFooter(
web_view->close();
frame->close();
}
@ -38,7 +207,7 @@ index c09ad6a..2a92296 100644
// static - Not anonymous so that platform implementations can use it.
float PrintWebViewHelper::RenderPageContent(blink::WebFrame* frame,
@@ -815,6 +813,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
@@ -830,6 +824,7 @@ PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view,
print_for_preview_(false),
delegate_(std::move(delegate)),
print_node_in_progress_(false),
@ -46,7 +215,91 @@ index c09ad6a..2a92296 100644
is_loading_(false),
is_scripted_preview_delayed_(false),
ipc_nesting_level_(0),
@@ -1254,7 +1253,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
@@ -888,10 +883,8 @@ void PrintWebViewHelper::PrintPage(blink::WebLocalFrame* frame,
return;
if (g_is_preview_enabled) {
-#if defined(ENABLE_PRINT_PREVIEW)
print_preview_context_.InitWithFrame(frame);
RequestPrintPreview(PRINT_PREVIEW_SCRIPTED);
-#endif
} else {
#if defined(ENABLE_BASIC_PRINTING)
Print(frame, blink::WebNode(), true);
@@ -915,14 +908,10 @@ bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
#endif // defined(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview)
-#endif
-#if defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
-#endif // defined(ENABLE_PRINT_PREVIEW)
IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked,
SetScriptedPrintBlocked)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -974,7 +963,6 @@ void PrintWebViewHelper::OnPrintForSystemDialog() {
}
#endif // defined(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintForPrintPreview(
const base::DictionaryValue& job_settings) {
CHECK_LE(ipc_nesting_level_, 1);
@@ -1039,7 +1027,6 @@ void PrintWebViewHelper::OnPrintForPrintPreview(
DidFinishPrinting(FAIL_PRINT);
}
}
-#endif // defined(ENABLE_BASIC_PRINTING) && defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::GetPageSizeAndContentAreaFromPageLayout(
const PageSizeMargins& page_layout_in_points,
@@ -1064,7 +1051,6 @@ void PrintWebViewHelper::UpdateFrameMarginsCssInfo(
ignore_css_margins_ = (margins_type != DEFAULT_MARGINS);
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintPreview(const base::DictionaryValue& settings) {
if (ipc_nesting_level_ > 1)
return;
@@ -1225,7 +1211,7 @@ bool PrintWebViewHelper::CreatePreviewDocument() {
return true;
}
-#if !defined(OS_MACOSX) && defined(ENABLE_PRINT_PREVIEW)
+#if !defined(OS_MACOSX)
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
const PrintMsg_Print_Params& print_params) {
@@ -1254,7 +1240,7 @@ bool PrintWebViewHelper::RenderPreviewPage(
}
return PreviewPageRendered(page_number, draft_metafile.get());
}
-#endif // !defined(OS_MACOSX) && defined(ENABLE_PRINT_PREVIEW)
+#endif // !defined(OS_MACOSX)
bool PrintWebViewHelper::FinalizePrintReadyDocument() {
DCHECK(!is_print_ready_metafile_sent_);
@@ -1284,7 +1270,6 @@ bool PrintWebViewHelper::FinalizePrintReadyDocument() {
Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params));
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnPrintingDone(bool success) {
if (ipc_nesting_level_ > 1)
@@ -1299,7 +1284,6 @@ void PrintWebViewHelper::SetScriptedPrintBlocked(bool blocked) {
is_scripted_printing_blocked_ = blocked;
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
if (ipc_nesting_level_ > 1)
return;
@@ -1310,7 +1294,9 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
// that instead.
auto plugin = delegate_->GetPdfElement(frame);
if (!plugin.isNull()) {
@ -56,87 +309,76 @@ index c09ad6a..2a92296 100644
return;
}
print_preview_context_.InitWithFrame(frame);
@@ -1287,7 +1288,7 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
@@ -1318,7 +1304,6 @@ void PrintWebViewHelper::OnInitiatePrintPreview(bool selection_only) {
? PRINT_PREVIEW_USER_INITIATED_SELECTION
: PRINT_PREVIEW_USER_INITIATED_ENTIRE_FRAME);
}
-#endif
bool PrintWebViewHelper::IsPrintingEnabled() {
bool result = false;
@@ -1344,11 +1329,9 @@ void PrintWebViewHelper::PrintNode(const blink::WebNode& node) {
// Make a copy of the node, in case RenderView::OnContextMenuClosed resets
// its |context_menu_node_|.
- if (!g_is_preview_enabled) {
+ if (!g_is_preview_enabled && !force_print_preview_) {
blink::WebNode duplicate_node(node);
Print(duplicate_node.document().frame(), duplicate_node, false);
- if (g_is_preview_enabled) {
-#if defined(ENABLE_PRINT_PREVIEW)
+ if (g_is_preview_enabled || force_print_preview_) {
print_preview_context_.InitWithNode(node);
RequestPrintPreview(PRINT_PREVIEW_USER_INITIATED_CONTEXT_NODE);
-#endif
} else {
diff --git printing/renderer/print_web_view_helper.h printing/renderer/print_web_view_helper.h
index 0de51e5..da084d0 100644
--- printing/renderer/print_web_view_helper.h
+++ printing/renderer/print_web_view_helper.h
@@ -317,7 +317,6 @@ class PrintWebViewHelper
const PrintMsg_PrintPages_Params& params,
int page_count);
#if defined(ENABLE_BASIC_PRINTING)
blink::WebNode duplicate_node(node);
@@ -1414,7 +1397,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
}
break;
-#if defined(ENABLE_PRINT_PREVIEW)
// Given the |device| and |canvas| to draw on, prints the appropriate headers
// and footers using strings from |header_footer_info| on to the canvas.
static void PrintHeaderAndFooter(blink::WebCanvas* canvas,
@@ -327,7 +326,6 @@ class PrintWebViewHelper
float webkit_scale_factor,
const PageSizeMargins& page_layout_in_points,
const PrintMsg_Print_Params& params);
case FAIL_PREVIEW:
int cookie =
print_pages_params_ ? print_pages_params_->params.document_cookie : 0;
@@ -1426,7 +1408,6 @@ void PrintWebViewHelper::DidFinishPrinting(PrintingResult result) {
}
print_preview_context_.Failed(notify_browser_of_print_failure_);
break;
-#endif // defined(ENABLE_PRINT_PREVIEW)
bool GetPrintFrame(blink::WebLocalFrame** frame);
@@ -506,6 +504,7 @@ class PrintWebViewHelper
ScriptingThrottler scripting_throttler_;
bool print_node_in_progress_;
+ bool force_print_preview_;
PrintPreviewContext print_preview_context_;
bool is_loading_;
bool is_scripted_preview_delayed_;
diff --git printing/renderer/print_web_view_helper_linux.cc printing/renderer/print_web_view_helper_linux.cc
index acc72ed..545178d 100644
--- printing/renderer/print_web_view_helper_linux.cc
+++ printing/renderer/print_web_view_helper_linux.cc
@@ -141,7 +141,6 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.params.display_header_footer) {
// |page_number| is 0-based, so 1 is added.
// TODO(vitalybuka) : why does it work only with 1.25?
@@ -150,7 +149,6 @@ void PrintWebViewHelper::PrintPageInternal(
scale_factor / 1.25, page_layout_in_points,
params.params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
prep_frame_view_.reset();
print_pages_params_.reset();
@@ -1558,7 +1539,6 @@ bool PrintWebViewHelper::CalculateNumberOfPages(blink::WebLocalFrame* frame,
return true;
}
RenderPageContent(frame, params.page_number, canvas_area, content_area,
scale_factor, canvas);
diff --git printing/renderer/print_web_view_helper_mac.mm printing/renderer/print_web_view_helper_mac.mm
index e682fa3..3a3aa8e 100644
--- printing/renderer/print_web_view_helper_mac.mm
+++ printing/renderer/print_web_view_helper_mac.mm
@@ -143,14 +143,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsPreviewMetafile(*canvas, is_preview);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.display_header_footer) {
PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas),
page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params);
}
bool PrintWebViewHelper::SetOptionsFromPdfDocument(
PrintHostMsg_SetOptionsFromDocument_Params* options) {
blink::WebLocalFrame* source_frame = print_preview_context_.source_frame();
@@ -1667,7 +1647,6 @@ bool PrintWebViewHelper::UpdatePrintSettings(
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
RenderPageContent(frame, page_number, canvas_area, content_area,
scale_factor, static_cast<blink::WebCanvas*>(canvas));
}
diff --git printing/renderer/print_web_view_helper_pdf_win.cc printing/renderer/print_web_view_helper_pdf_win.cc
index 11401bf..2ed0668 100644
--- printing/renderer/print_web_view_helper_pdf_win.cc
+++ printing/renderer/print_web_view_helper_pdf_win.cc
@@ -151,14 +151,12 @@ void PrintWebViewHelper::PrintPageInternal(
#if defined(ENABLE_BASIC_PRINTING)
bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame,
@@ -1759,11 +1738,14 @@ void PrintWebViewHelper::PrintPageInternal(
gfx::Rect canvas_area =
params.params.display_header_footer ? gfx::Rect(page_size) : content_area;
-#if defined(OS_WIN) || defined(ENABLE_PRINT_PREVIEW)
+#if defined(OS_WIN)
float webkit_page_shrink_factor =
frame->getPrintPageShrink(params.page_number);
float scale_factor = css_scale_factor * webkit_page_shrink_factor;
+#else
+ float scale_factor = css_scale_factor / 1.25f;
#endif
+
// TODO(thestig) GetVectorCanvasForNewPage() and RenderPageContent() take a
// different scale factor vs Windows. Figure out why and combine the two.
#if defined(OS_WIN)
@@ -1779,14 +1761,12 @@ void PrintWebViewHelper::PrintPageInternal(
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
@ -151,6 +393,154 @@ index 11401bf..2ed0668 100644
float webkit_scale_factor =
RenderPageContent(frame, params.page_number, canvas_area, content_area,
@@ -1841,7 +1821,6 @@ bool PrintWebViewHelper::CopyMetafileDataToSharedMem(
#endif // defined(OS_WIN)
}
-#if defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::ShowScriptedPrintPreview() {
if (is_scripted_preview_delayed_) {
is_scripted_preview_delayed_ = false;
@@ -1969,7 +1948,6 @@ bool PrintWebViewHelper::PreviewPageRendered(int page_number,
Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params));
return true;
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
PrintWebViewHelper::PrintPreviewContext::PrintPreviewContext()
: total_page_count_(0),
diff --git printing/renderer/print_web_view_helper.h printing/renderer/print_web_view_helper.h
index ca10384..7aacfbc 100644
--- printing/renderer/print_web_view_helper.h
+++ printing/renderer/print_web_view_helper.h
@@ -137,9 +137,7 @@ class PrintWebViewHelper
OK,
FAIL_PRINT_INIT,
FAIL_PRINT,
-#if defined(ENABLE_PRINT_PREVIEW)
FAIL_PREVIEW,
-#endif
};
enum PrintPreviewErrorBuckets {
@@ -173,10 +171,8 @@ class PrintWebViewHelper
void OnPrintForSystemDialog();
void OnPrintForPrintPreview(const base::DictionaryValue& job_settings);
#endif // defined(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_PRINT_PREVIEW)
void OnInitiatePrintPreview(bool selection_only);
void OnPrintPreview(const base::DictionaryValue& settings);
-#endif // defined(ENABLE_PRINT_PREVIEW)
void OnPrintingDone(bool success);
// Get |page_size| and |content_area| information from
@@ -189,7 +185,6 @@ class PrintWebViewHelper
// Update |ignore_css_margins_| based on settings.
void UpdateFrameMarginsCssInfo(const base::DictionaryValue& settings);
-#if defined(ENABLE_PRINT_PREVIEW)
// Prepare frame for creating preview document.
void PrepareFrameForPreviewDocument();
@@ -206,7 +201,6 @@ class PrintWebViewHelper
// Finalize the print ready preview document.
bool FinalizePrintReadyDocument();
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Enable/Disable window.print calls. If |blocked| is true window.print
// calls will silently fail. Call with |blocked| set to false to reenable.
@@ -235,7 +229,6 @@ class PrintWebViewHelper
const blink::WebNode& node,
int* number_of_pages);
-#if defined(ENABLE_PRINT_PREVIEW)
// Set options for print preset from source PDF document.
bool SetOptionsFromPdfDocument(
PrintHostMsg_SetOptionsFromDocument_Params* options);
@@ -246,7 +239,6 @@ class PrintWebViewHelper
bool UpdatePrintSettings(blink::WebLocalFrame* frame,
const blink::WebNode& node,
const base::DictionaryValue& passed_job_settings);
-#endif // defined(ENABLE_PRINT_PREVIEW)
// Get final print settings from the user.
// Return false if the user cancels or on error.
@@ -321,7 +313,6 @@ class PrintWebViewHelper
const PrintMsg_PrintPages_Params& params,
int page_count);
-#if defined(ENABLE_PRINT_PREVIEW)
// Given the |device| and |canvas| to draw on, prints the appropriate headers
// and footers using strings from |header_footer_info| on to the canvas.
static void PrintHeaderAndFooter(blink::WebCanvas* canvas,
@@ -331,7 +322,6 @@ class PrintWebViewHelper
float webkit_scale_factor,
const PageSizeMargins& page_layout_in_points,
const PrintMsg_Print_Params& params);
-#endif // defined(ENABLE_PRINT_PREVIEW)
bool GetPrintFrame(blink::WebLocalFrame** frame);
@@ -343,7 +333,6 @@ class PrintWebViewHelper
bool IsScriptInitiatedPrintAllowed(blink::WebFrame* frame,
bool user_initiated);
-#if defined(ENABLE_PRINT_PREVIEW)
// Shows scripted print preview when options from plugin are available.
void ShowScriptedPrintPreview();
@@ -359,7 +348,6 @@ class PrintWebViewHelper
// |metafile| is the rendered page. Otherwise |metafile| is NULL.
// Returns true if print preview should continue, false on failure.
bool PreviewPageRendered(int page_number, PdfMetafileSkia* metafile);
-#endif // defined(ENABLE_PRINT_PREVIEW)
void SetPrintPagesParams(const PrintMsg_PrintPages_Params& settings);
@@ -512,6 +500,7 @@ class PrintWebViewHelper
ScriptingThrottler scripting_throttler_;
bool print_node_in_progress_;
+ bool force_print_preview_;
PrintPreviewContext print_preview_context_;
bool is_loading_;
bool is_scripted_preview_delayed_;
diff --git printing/renderer/print_web_view_helper_mac.mm printing/renderer/print_web_view_helper_mac.mm
index e94f21e..e148860 100644
--- printing/renderer/print_web_view_helper_mac.mm
+++ printing/renderer/print_web_view_helper_mac.mm
@@ -69,7 +69,6 @@ void PrintWebViewHelper::PrintPageInternal(
Send(new PrintHostMsg_DidPrintPage(routing_id(), page_params));
}
-#if defined(ENABLE_PRINT_PREVIEW)
bool PrintWebViewHelper::RenderPreviewPage(
int page_number,
const PrintMsg_Print_Params& print_params) {
@@ -110,7 +109,6 @@ bool PrintWebViewHelper::RenderPreviewPage(
}
return PreviewPageRendered(page_number, draft_metafile.get());
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
int page_number,
@@ -145,14 +143,12 @@ void PrintWebViewHelper::RenderPage(const PrintMsg_Print_Params& params,
MetafileSkiaWrapper::SetMetafileOnCanvas(*canvas, metafile);
skia::SetIsPreviewMetafile(*canvas, is_preview);
-#if defined(ENABLE_PRINT_PREVIEW)
if (params.display_header_footer) {
PrintHeaderAndFooter(static_cast<blink::WebCanvas*>(canvas),
page_number + 1,
print_preview_context_.total_page_count(), *frame,
scale_factor, page_layout_in_points, params);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
RenderPageContent(frame, page_number, canvas_area, content_area,
scale_factor, static_cast<blink::WebCanvas*>(canvas));
}
diff --git resources/printing_resources.grdp resources/printing_resources.grdp
index 7213746..32b8b1e 100644
--- resources/printing_resources.grdp

View File

@ -14,7 +14,7 @@ index 1b6d8a6..b606a30 100644
WebContents::CreateParams::~CreateParams() {
}
diff --git web_contents.h web_contents.h
index 6f68c96..2ba25d7 100644
index a96ed1c..d0a6772 100644
--- web_contents.h
+++ web_contents.h
@@ -54,9 +54,11 @@ class PageState;
@ -41,10 +41,10 @@ index 6f68c96..2ba25d7 100644
// Creates a new WebContents.
diff --git web_contents_delegate.cc web_contents_delegate.cc
index e247f5b..45968ce 100644
index 0a1d3f1..1d03511 100644
--- web_contents_delegate.cc
+++ web_contents_delegate.cc
@@ -170,7 +170,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
@@ -144,7 +144,9 @@ bool WebContentsDelegate::ShouldCreateWebContents(
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,
@ -56,7 +56,7 @@ index e247f5b..45968ce 100644
}
diff --git web_contents_delegate.h web_contents_delegate.h
index 6379fe4..d8e8844 100644
index ed46e43..9ffeee9 100644
--- web_contents_delegate.h
+++ web_contents_delegate.h
@@ -41,9 +41,11 @@ class DownloadItem;
@ -71,7 +71,7 @@ index 6379fe4..d8e8844 100644
struct ColorSuggestion;
struct ContextMenuParams;
struct DropData;
@@ -303,7 +305,9 @@ class CONTENT_EXPORT WebContentsDelegate {
@@ -305,7 +307,9 @@ class CONTENT_EXPORT WebContentsDelegate {
const std::string& frame_name,
const GURL& target_url,
const std::string& partition_id,

View File

@ -1,5 +1,5 @@
diff --git render_widget_host_view_mac.mm render_widget_host_view_mac.mm
index 8a8f916..200c7b6 100644
index ef38d30..00fb343 100644
--- render_widget_host_view_mac.mm
+++ render_widget_host_view_mac.mm
@@ -530,9 +530,6 @@ RenderWidgetHostViewMac::RenderWidgetHostViewMac(RenderWidgetHost* widget,

View File

@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/render_widget_host_view_aura.cc content/browser/renderer_host/render_widget_host_view_aura.cc
index 6968dfc..ecb9129 100644
index c5494d9..6515181 100644
--- content/browser/renderer_host/render_widget_host_view_aura.cc
+++ content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -774,6 +774,13 @@ void RenderWidgetHostViewAura::SetKeyboardFocus() {
@ -13,8 +13,8 @@ index 6968dfc..ecb9129 100644
+ host->Show();
+ }
+#endif
if (host_ && set_focus_on_mouse_down_) {
set_focus_on_mouse_down_ = false;
if (host_ && set_focus_on_mouse_down_or_key_event_) {
set_focus_on_mouse_down_or_key_event_ = false;
host_->Focus();
diff --git content/browser/renderer_host/render_widget_host_view_base.cc content/browser/renderer_host/render_widget_host_view_base.cc
index a2a0884..c6eef9d 100644
@ -91,10 +91,10 @@ index a8e088c..838b6a0 100644
return host ? host->GetAcceleratedWidget() : NULL;
}
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
index 48368f9..6a566ba 100644
index c354154..c6f0fc9 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc
@@ -85,6 +85,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
@@ -84,6 +84,7 @@ DesktopWindowTreeHostWin::DesktopWindowTreeHostWin(
should_animate_window_close_(false),
pending_close_(false),
has_non_client_view_(false),
@ -102,7 +102,7 @@ index 48368f9..6a566ba 100644
tooltip_(NULL) {
}
@@ -131,8 +132,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
@@ -133,8 +134,12 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window,
native_widget_delegate_);
HWND parent_hwnd = NULL;
@ -116,7 +116,7 @@ index 48368f9..6a566ba 100644
message_handler_->set_remove_standard_frame(params.remove_standard_frame);
@@ -793,11 +798,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
@@ -799,11 +804,15 @@ void DesktopWindowTreeHostWin::HandleFrameChanged() {
}
void DesktopWindowTreeHostWin::HandleNativeFocus(HWND last_focused_window) {
@ -135,10 +135,10 @@ index 48368f9..6a566ba 100644
bool DesktopWindowTreeHostWin::HandleMouseEvent(const ui::MouseEvent& event) {
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_win.h ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
index bee915a..23f93e2 100644
index ad82485..13e74b9 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_win.h
@@ -243,6 +243,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
@@ -244,6 +244,10 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin
// Init time, before the Widget has created the NonClientView.
bool has_non_client_view_;
@ -150,7 +150,7 @@ index bee915a..23f93e2 100644
// a reference.
corewm::TooltipWin* tooltip_;
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
index d3aafd9..8bbfd6a 100644
index f7495f0..3d9b9a2 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc
@@ -168,6 +168,7 @@ DesktopWindowTreeHostX11::DesktopWindowTreeHostX11(
@ -208,7 +208,7 @@ index d3aafd9..8bbfd6a 100644
return bounds_in_pixels_.origin();
}
@@ -1135,9 +1144,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
@@ -1139,9 +1148,15 @@ void DesktopWindowTreeHostX11::InitX11Window(
use_argb_visual_ = true;
}
@ -225,7 +225,7 @@ index d3aafd9..8bbfd6a 100644
bounds_in_pixels_.y(), bounds_in_pixels_.width(),
bounds_in_pixels_.height(),
0, // border width
@@ -1766,6 +1781,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
@@ -1770,6 +1785,10 @@ uint32_t DesktopWindowTreeHostX11::DispatchEvent(
}
break;
}
@ -346,7 +346,7 @@ index 9b20295..20b1aec 100644
x_active_window_ = None;
}
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
index aaa9320..c9e17a0 100644
index 18aa4c6..147c5a7 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -126,6 +126,7 @@ Widget::InitParams::InitParams()
@ -389,7 +389,7 @@ index aaa9320..c9e17a0 100644
// This must come after SetContentsView() or it might not be able to find
// the correct NativeTheme (on Linux). See http://crbug.com/384492
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
index 4ad8c2b..abf716c 100644
index 80aadde..c278b84 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -234,6 +234,7 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,

View File

@ -1,8 +1,8 @@
diff --git Source/web/ChromeClientImpl.cpp Source/web/ChromeClientImpl.cpp
index 8a40549..3011ab4 100644
index e728623..e0f051e 100644
--- Source/web/ChromeClientImpl.cpp
+++ Source/web/ChromeClientImpl.cpp
@@ -829,7 +829,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
@@ -825,7 +825,7 @@ bool ChromeClientImpl::hasOpenedPopup() const
PassRefPtrWillBeRawPtr<PopupMenu> ChromeClientImpl::openPopupMenu(LocalFrame& frame, HTMLSelectElement& select)
{
notifyPopupOpeningObservers();
@ -12,7 +12,7 @@ index 8a40549..3011ab4 100644
ASSERT(RuntimeEnabledFeatures::pagePopupEnabled());
diff --git Source/web/WebViewImpl.cpp Source/web/WebViewImpl.cpp
index a065625..bbd9093 100644
index 416f9d8..43934e3 100644
--- Source/web/WebViewImpl.cpp
+++ Source/web/WebViewImpl.cpp
@@ -476,6 +476,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client)
@ -23,20 +23,7 @@ index a065625..bbd9093 100644
, m_doingDragAndDrop(false)
, m_ignoreInputEvents(false)
, m_compositorDeviceScaleFactorOverride(0)
@@ -2272,12 +2273,6 @@ void WebViewImpl::mouseCaptureLost()
void WebViewImpl::setFocus(bool enable)
{
- // On Windows, unnecessary setFocus(false) is called if a popup is shown and
- // the hotdog menu is clicked.
- // TODO(tkent): This should be fixed in Chromium.
- if (!enable && m_pagePopup)
- return;
-
m_page->focusController().setFocused(enable);
if (enable) {
m_page->focusController().setActive(true);
@@ -4151,9 +4146,14 @@ void WebViewImpl::pageScaleFactorChanged()
@@ -4138,9 +4139,14 @@ void WebViewImpl::pageScaleFactorChanged()
m_client->pageScaleFactorChanged();
}
@ -53,10 +40,10 @@ index a065625..bbd9093 100644
void WebViewImpl::startDragging(LocalFrame* frame,
diff --git Source/web/WebViewImpl.h Source/web/WebViewImpl.h
index 9288a7f..18b0067 100644
index cc4c325..b709524 100644
--- Source/web/WebViewImpl.h
+++ Source/web/WebViewImpl.h
@@ -396,7 +396,8 @@ public:
@@ -395,7 +395,8 @@ public:
// Returns true if popup menus should be rendered by the browser, false if
// they should be rendered by WebKit (which is the default).
@ -66,7 +53,7 @@ index 9288a7f..18b0067 100644
bool shouldAutoResize() const
{
@@ -691,6 +692,8 @@ private:
@@ -692,6 +693,8 @@ private:
float m_fakePageScaleAnimationPageScaleFactor;
bool m_fakePageScaleAnimationUseAnchor;
@ -76,10 +63,10 @@ index 9288a7f..18b0067 100644
bool m_ignoreInputEvents;
diff --git public/web/WebView.h public/web/WebView.h
index e21137b..e435d73 100644
index 18b2e9d..8b0b784 100644
--- public/web/WebView.h
+++ public/web/WebView.h
@@ -411,6 +411,7 @@ public:
@@ -408,6 +408,7 @@ public:
// Sets whether select popup menus should be rendered by the browser.
BLINK_EXPORT static void setUseExternalPopupMenus(bool);