Skip to content

Commit

Permalink
fix: silent printing mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr committed Jul 11, 2019
1 parent 8e68e6e commit f903231
Show file tree
Hide file tree
Showing 13 changed files with 77 additions and 393 deletions.
3 changes: 1 addition & 2 deletions patches/common/chromium/.patches
@@ -1,4 +1,3 @@
portals_fix_crash_when_detaching_oopif_from_portal.patch
add_realloc.patch
build_gn.patch
dcheck.patch
Expand Down Expand Up @@ -48,6 +47,7 @@ enable_widevine.patch
chrome_key_systems.patch
allow_nested_error_trackers.patch
blink_initialization_order.patch
disable_detach_webview_frame.patch
ssl_security_state_tab_helper.patch
exclude-a-few-test-files-from-build.patch
expose-net-observer-api.patch
Expand Down Expand Up @@ -77,4 +77,3 @@ viz_osr.patch
video_capturer_dirty_rect.patch
unsandboxed_ppapi_processes_skip_zygote.patch
autofill_size_calculation.patch
disable_detach_webview_frame.patch
2 changes: 1 addition & 1 deletion patches/common/chromium/browser_compositor_mac.patch
Expand Up @@ -29,7 +29,7 @@ diff --git a/content/browser/renderer_host/browser_compositor_view_mac.mm b/cont
index 0817b4eca4f4e6f7f5d250589c1e4dbcc068237c..dcc2340e59771e8d73de7e97fa2371d8bec7b149 100644
--- a/content/browser/renderer_host/browser_compositor_view_mac.mm
+++ b/content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -79,6 +79,12 @@
@@ -79,6 +79,12 @@ BrowserCompositorMac::~BrowserCompositorMac() {
DCHECK_EQ(1u, num_erased);
}

Expand Down
10 changes: 5 additions & 5 deletions patches/common/chromium/color_chooser_mac.patch
Expand Up @@ -63,7 +63,7 @@ diff --git a/chrome/browser/ui/cocoa/color_chooser_mac.mm b/chrome/browser/ui/co
index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d132b7d51 100644
--- a/chrome/browser/ui/cocoa/color_chooser_mac.mm
+++ b/chrome/browser/ui/cocoa/color_chooser_mac.mm
@@ -39,16 +39,18 @@
@@ -39,16 +39,18 @@ void ColorChooserMac::DidChooseColorInColorPanel(SkColor color) {
web_contents_->DidChooseColorInColorChooser(color);
}

Expand All @@ -87,7 +87,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}

void ColorChooserMac::SetSelectedColor(SkColor color) {
@@ -67,9 +69,14 @@ - (id)initWithChooser:(ColorChooserMac*)chooser {
@@ -67,9 +69,14 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
chooser_ = chooser;
NSColorPanel* panel = [NSColorPanel sharedColorPanel];
[panel setShowsAlpha:NO];
Expand All @@ -103,7 +103,7 @@ index bf47154f0a880f1c6143065e5c6d060f1df73765..e7cdab7a23d96345cc6e8ec578a8616d
}
return self;
}
@@ -82,19 +89,21 @@ - (void)dealloc {
@@ -82,19 +89,21 @@ void ColorChooserMac::SetSelectedColor(SkColor color) {
// the ColorPanelCocoa is still the target.
BOOL respondsToPrivateTargetMethod =
[panel respondsToSelector:@selector(__target)];
Expand Down Expand Up @@ -134,7 +134,7 @@ diff --git a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm b/chrome/brow
index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462715a4751 100644
--- a/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/color_panel_cocoa_unittest.mm
@@ -28,28 +28,6 @@ void SetUp() override {
@@ -28,28 +28,6 @@ class ColorPanelCocoaTest : public CocoaTest {
}
};

Expand Down Expand Up @@ -163,7 +163,7 @@ index 83185ceb9bbd29bf38fce7f72c23f3a5b15ba6c8..823365fdfc0bceceeed6f5edc00b3462
TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {
NSColorPanel* nscolor_panel = [NSColorPanel sharedColorPanel];
@autoreleasepool {
@@ -61,19 +39,12 @@ void SetUp() override {
@@ -61,19 +39,12 @@ TEST_F(ColorPanelCocoaTest, ClearTargetOnEnd) {

// Confirm the NSColorPanel's configuration by the ColorChooserMac's
// ColorPanelCocoa.
Expand Down
4 changes: 2 additions & 2 deletions patches/common/chromium/command-ismediakey.patch
Expand Up @@ -18,7 +18,7 @@ diff --git a/chrome/browser/extensions/global_shortcut_listener_mac.mm b/chrome/
index befe726af9c10b1563a7fc0bb77cc55f65943d5c..46c6fe08bab8471007f78d3ef227e5195bfdf0e1 100644
--- a/chrome/browser/extensions/global_shortcut_listener_mac.mm
+++ b/chrome/browser/extensions/global_shortcut_listener_mac.mm
@@ -21,6 +21,26 @@
@@ -21,6 +21,26 @@ using extensions::GlobalShortcutListenerMac;

namespace extensions {

Expand Down Expand Up @@ -104,7 +104,7 @@ index b48fa8e63867021bdd77bf585a0e02c366980d91..bae9e24e7bcf7615be243bcb5629cc59
}
return VKEY_UNKNOWN;
}
@@ -190,7 +196,10 @@ static CGEventRef EventTapCallback(CGEventTapProxy proxy,
@@ -190,7 +196,10 @@ CGEventRef MediaKeysListenerImpl::EventTapCallback(CGEventTapProxy proxy,
int key_code = (data1 & 0xFFFF0000) >> 16;
if (key_code != NX_KEYTYPE_PLAY && key_code != NX_KEYTYPE_NEXT &&
key_code != NX_KEYTYPE_PREVIOUS && key_code != NX_KEYTYPE_FAST &&
Expand Down
10 changes: 5 additions & 5 deletions patches/common/chromium/disable_detach_webview_frame.patch
Expand Up @@ -12,19 +12,19 @@ this patch was introduced in Chrome 66.
Update(zcbenz): The bug is still in Chrome 72.

diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc
index 075810f5553731b56b08b5e6e35854bdebed2021..8252a79c95c42f491fba28955993fff127e8c51a 100644
index a5e18f465f79416c05fd3ab630b40b079a7a7cbc..d6f4717ee2122b86611d6149d5d1a9105d1baff1 100644
--- a/content/browser/frame_host/render_frame_proxy_host.cc
+++ b/content/browser/frame_host/render_frame_proxy_host.cc
@@ -261,6 +261,12 @@ void RenderFrameProxyHost::SetDestructionCallback(
@@ -263,6 +263,12 @@ void RenderFrameProxyHost::SetDestructionCallback(

void RenderFrameProxyHost::OnDetach() {
if (frame_tree_node_->render_manager()->IsMainFrameForInnerDelegate()) {
if (frame_tree_node_->render_manager()->ForInnerDelegate()) {
+ // Don't detach the frame for webview, we will manage the WebContents
+ // manually.
+ // We should revisit this bug after upgrading to newer versions of Chrome,
+ // this patch was introduced in Chrome 66.
+ return;
+
// Only main frame proxy can detach for inner WebContents.
DCHECK(frame_tree_node_->IsMainFrame());
frame_tree_node_->render_manager()->RemoveOuterDelegateFrame();
return;
}
87 changes: 5 additions & 82 deletions patches/common/chromium/frame_host_manager.patch
Expand Up @@ -6,45 +6,11 @@ Subject: frame_host_manager.patch
Allows embedder to intercept site instances chosen by chromium
and respond with custom instance.

diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc
index 8aca9384edb69012628fc9afb98f647aeec7d593..10fe96e6c9bfc7f33a81ad9b75c75d4dda776d7c 100644
--- a/content/browser/browsing_instance.cc
+++ b/content/browser/browsing_instance.cc
@@ -53,6 +53,13 @@ scoped_refptr<SiteInstanceImpl> BrowsingInstance::GetSiteInstanceForURL(
return instance;
}

+scoped_refptr<SiteInstanceImpl> BrowsingInstance::CreateSiteInstanceForURL(
+ const GURL& url) {
+ scoped_refptr<SiteInstanceImpl> instance = new SiteInstanceImpl(this);
+ instance->SetSite(url);
+ return instance;
+}
+
void BrowsingInstance::RegisterSiteInstance(SiteInstanceImpl* site_instance) {
DCHECK(site_instance->browsing_instance_.get() == this);
DCHECK(site_instance->HasSite());
diff --git a/content/browser/browsing_instance.h b/content/browser/browsing_instance.h
index d439dfbb603876f942ff40fe1a505f9498f57c23..fd576eb894e06fe6c5cb21351b2b95b0a8444dce 100644
--- a/content/browser/browsing_instance.h
+++ b/content/browser/browsing_instance.h
@@ -100,6 +100,11 @@ class CONTENT_EXPORT BrowsingInstance final
// SiteInstance per site.
scoped_refptr<SiteInstanceImpl> GetSiteInstanceForURL(const GURL& url);

+ // Create a new SiteInstance for the given URL bound the current
+ // BrowsingInstance.
+ scoped_refptr<SiteInstanceImpl> CreateSiteInstanceForURL(
+ const GURL& url);
+
// Adds the given SiteInstance to our map, to ensure that we do not create
// another SiteInstance for the same site.
void RegisterSiteInstance(SiteInstanceImpl* site_instance);
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 0e3fc30fae933e0493920ed1823b086ac6ceee61..6dbb73c964601f0dae7ef6460a0ae2a048634a35 100644
index f9f8e5204d1d92e87370f859c294919d2a1991c3..ff42619d67b916bacb63f99b2391c905cccde218 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -1984,6 +1984,16 @@ bool RenderFrameHostManager::InitRenderView(
@@ -1978,6 +1978,16 @@ bool RenderFrameHostManager::InitRenderView(
scoped_refptr<SiteInstance>
RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
const NavigationRequest& request) {
Expand All @@ -61,7 +27,7 @@ index 0e3fc30fae933e0493920ed1823b086ac6ceee61..6dbb73c964601f0dae7ef6460a0ae2a0
// First, check if the navigation can switch SiteInstances. If not, the
// navigation should use the current SiteInstance.
SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance();
@@ -2016,6 +2026,51 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -2010,6 +2020,51 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
request.common_params().url);
no_renderer_swap_allowed |=
request.from_begin_navigation() && !can_renderer_initiate_transfer;
Expand All @@ -84,7 +50,7 @@ index 0e3fc30fae933e0493920ed1823b086ac6ceee61..6dbb73c964601f0dae7ef6460a0ae2a0
+ overriden_site_instance =
+ candidate_site_instance
+ ? candidate_site_instance
+ : current_site_instance->CreateRelatedSiteInstance(
+ : SiteInstance::CreateForURL(browser_context,
+ request.common_params().url);
+ break;
+ case ContentBrowserClient::SiteInstanceForNavigationType::FORCE_CURRENT:
Expand Down Expand Up @@ -113,7 +79,7 @@ index 0e3fc30fae933e0493920ed1823b086ac6ceee61..6dbb73c964601f0dae7ef6460a0ae2a0
} else {
// Subframe navigations will use the current renderer, unless specifically
// allowed to swap processes.
@@ -2027,23 +2082,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
@@ -2021,23 +2076,17 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
if (no_renderer_swap_allowed && !should_swap_for_error_isolation)
return scoped_refptr<SiteInstance>(current_site_instance);

Expand Down Expand Up @@ -141,33 +107,6 @@ index 0e3fc30fae933e0493920ed1823b086ac6ceee61..6dbb73c964601f0dae7ef6460a0ae2a0
return dest_site_instance;
}

diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
index e1a7560631bd07f812315cb9932475cf890d8a6b..34b947c34a3eb676286f43fcb23100134f751dfb 100644
--- a/content/browser/site_instance_impl.cc
+++ b/content/browser/site_instance_impl.cc
@@ -236,6 +236,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) {
return browsing_instance_->HasSiteInstance(url);
}

+scoped_refptr<SiteInstance> SiteInstanceImpl::CreateRelatedSiteInstance(const GURL& url) {
+ return browsing_instance_->CreateSiteInstanceForURL(url);
+}
+
scoped_refptr<SiteInstance> SiteInstanceImpl::GetRelatedSiteInstance(
const GURL& url) {
return browsing_instance_->GetSiteInstanceForURL(url);
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h
index da2696d679953096356e0c73891ff97854f76b54..c4c8e29a7723c4a22e6e52bd2f9ff792241b963a 100644
--- a/content/browser/site_instance_impl.h
+++ b/content/browser/site_instance_impl.h
@@ -70,6 +70,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance,
BrowserContext* GetBrowserContext() const override;
const GURL& GetSiteURL() const override;
scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override;
+ scoped_refptr<SiteInstance> CreateRelatedSiteInstance(const GURL& url) override;
bool IsRelatedSiteInstance(const SiteInstance* instance) override;
size_t GetRelatedActiveContentsCount() override;
bool RequiresDedicatedProcess() override;
diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc
index 64c4d9eb2dfb8f53f7a6c8f00140b0cf22f18a49..0aff71c4339d0eacecf6b6d86ab750738696c31e 100644
--- a/content/public/browser/content_browser_client.cc
Expand Down Expand Up @@ -231,19 +170,3 @@ index fdb9d7b8859270b36453e25349f7d84c44a6ce92..9f0a966d8abf72b606906b14f00748b4
// Allows the embedder to set any number of custom BrowserMainParts
// implementations for the browser startup code. See comments in
// browser_main_parts.h.
diff --git a/content/public/browser/site_instance.h b/content/public/browser/site_instance.h
index 3b4c1cfacdad7ecc99b61cc0c2e4e71b72a855b6..d587f1e9211aa0e7636aa255a724ec9bb7399024 100644
--- a/content/public/browser/site_instance.h
+++ b/content/public/browser/site_instance.h
@@ -116,6 +116,11 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> {
// corresponds to a site URL with the host "example.com".
virtual const GURL& GetSiteURL() const = 0;

+ // Create a SiteInstance for the given URL that shares the current
+ // BrowsingInstance.
+ virtual scoped_refptr<SiteInstance> CreateRelatedSiteInstance(
+ const GURL& url) = 0;
+
// Gets a SiteInstance for the given URL that shares the current
// BrowsingInstance, creating a new SiteInstance if necessary. This ensures
// that a BrowsingInstance only has one SiteInstance per site, so that pages
6 changes: 3 additions & 3 deletions patches/common/chromium/mas-cfisobjc.patch
Expand Up @@ -9,15 +9,15 @@ diff --git a/base/mac/foundation_util.mm b/base/mac/foundation_util.mm
index 2d619e791c03a17d29ed47abe765a0a644b364bc..c36989c429344d85a0f5efe11754de13b12ec5df 100644
--- a/base/mac/foundation_util.mm
+++ b/base/mac/foundation_util.mm
@@ -26,7 +26,6 @@
@@ -26,7 +26,6 @@ CFTypeID SecKeyGetTypeID();
#if !defined(OS_IOS)
CFTypeID SecACLGetTypeID();
CFTypeID SecTrustedApplicationGetTypeID();
-Boolean _CFIsObjC(CFTypeID typeID, CFTypeRef obj);
#endif
} // extern "C"

@@ -326,8 +325,7 @@ void SetBaseBundleID(const char* new_base_bundle_id) {
@@ -326,8 +325,7 @@ NSFont* CFToNSCast(CTFontRef cf_val) {
const_cast<NSFont*>(reinterpret_cast<const NSFont*>(cf_val));
DCHECK(!cf_val ||
CTFontGetTypeID() == CFGetTypeID(cf_val) ||
Expand All @@ -27,7 +27,7 @@ index 2d619e791c03a17d29ed47abe765a0a644b364bc..c36989c429344d85a0f5efe11754de13
return ns_val;
}

@@ -395,9 +393,6 @@ CTFontRef NSToCFCast(NSFont* ns_val) {
@@ -395,9 +393,6 @@ CFCast<CTFontRef>(const CFTypeRef& cf_val) {
return (CTFontRef)(cf_val);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/common/chromium/mas_blink_no_private_api.patch
Expand Up @@ -18,7 +18,7 @@ index 94afefcee81b87c05bf9b1199d90d3d4b5ea84a6..2ec7f04c71824b47de1ddbf1f0e8625d
extern "C" {

// Kill ring calls. Would be better to use NSKillRing.h, but that's not
@@ -39,38 +40,53 @@
@@ -39,38 +40,53 @@ NSString* _NSYankFromKillRing();
void _NSNewKillRingSequence();
void _NSSetKillRingToYankedState();
}
Expand Down Expand Up @@ -92,7 +92,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185

namespace blink {

@@ -73,10 +75,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -73,10 +75,12 @@ bool ThemePainterMac::PaintTextField(const Node* node,
// behavior change while remaining a fragile solution.
// https://bugs.chromium.org/p/chromium/issues/detail?id=658085#c3
if (!use_ns_text_field_cell) {
Expand All @@ -105,7 +105,7 @@ index 7a1260db0a139f9f3f8a823af2c220f36162812a..bf9cf7046e2fc9cdfee5b92f2a348185
return false;
}

@@ -162,10 +166,12 @@ void _NSDrawCarbonThemeListBox(NSRect frame,
@@ -162,10 +166,12 @@ bool ThemePainterMac::PaintTextArea(const Node* node,
const PaintInfo& paint_info,
const IntRect& r) {
LocalCurrentGraphicsContext local_context(paint_info.context, r);
Expand Down

0 comments on commit f903231

Please sign in to comment.