|
@@ -1,6 +1,6 @@
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
From: deepak1556 <[email protected]>
|
|
|
-Date: Wed, 14 Nov 2018 20:38:46 +0530
|
|
|
+Date: Mon, 3 Jun 2019 14:20:05 -0700
|
|
|
Subject: frame_host_manager.patch
|
|
|
|
|
|
Allows embedder to intercept site instances chosen by chromium
|
|
@@ -42,7 +42,7 @@ index 775b64a8d20f89845812852a2904a1e6875c2b4a..5235b57bbf44fc7b30ca6943c43a290f
|
|
|
// 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 b5301d164138f21ca8ae01abfb153efde51ec324..55f87cc788c7eed13494ebe6ea6eb18027a04996 100644
|
|
|
+index 297b61198dd46114b3d8c89488a71ed01aa299c4..40b848a8b448bed2d167bf5f6c0f25971b603ed2 100644
|
|
|
--- a/content/browser/frame_host/render_frame_host_manager.cc
|
|
|
+++ b/content/browser/frame_host/render_frame_host_manager.cc
|
|
|
@@ -2127,6 +2127,20 @@ bool RenderFrameHostManager::InitRenderView(
|
|
@@ -66,7 +66,7 @@ index b5301d164138f21ca8ae01abfb153efde51ec324..55f87cc788c7eed13494ebe6ea6eb180
|
|
|
// 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();
|
|
|
-@@ -2159,6 +2173,53 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
|
+@@ -2158,6 +2172,53 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
|
request.common_params().url);
|
|
|
no_renderer_swap_allowed |=
|
|
|
request.from_begin_navigation() && !can_renderer_initiate_transfer;
|
|
@@ -120,7 +120,7 @@ index b5301d164138f21ca8ae01abfb153efde51ec324..55f87cc788c7eed13494ebe6ea6eb180
|
|
|
} else {
|
|
|
// Subframe navigations will use the current renderer, unless specifically
|
|
|
// allowed to swap processes.
|
|
|
-@@ -2170,23 +2231,28 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
|
+@@ -2169,23 +2230,28 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
|
if (no_renderer_swap_allowed && !should_swap_for_error_isolation)
|
|
|
return scoped_refptr<SiteInstance>(current_site_instance);
|
|
|
|
|
@@ -167,22 +167,22 @@ index fd184108a7993094c29be3f7ebde658e259ede2c..75aa4a6b7d58a1bebe34efc923953c69
|
|
|
const GURL& url) {
|
|
|
return browsing_instance_->GetSiteInstanceForURL(
|
|
|
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h
|
|
|
-index a46901055bdf17b6b0dab14edf753b234dc04a12..29c201b0c95eb0c7a35f47d6f3ab5b48c73dbf15 100644
|
|
|
+index a46901055bdf17b6b0dab14edf753b234dc04a12..113660b6eeff81d56a0415b0fa16211efd8d8e14 100644
|
|
|
--- a/content/browser/site_instance_impl.h
|
|
|
+++ b/content/browser/site_instance_impl.h
|
|
|
@@ -83,6 +83,7 @@ class CONTENT_EXPORT SiteInstanceImpl final : public SiteInstance,
|
|
|
BrowserContext* GetBrowserContext() override;
|
|
|
const GURL& GetSiteURL() override;
|
|
|
scoped_refptr<SiteInstance> GetRelatedSiteInstance(const GURL& url) override;
|
|
|
-+ scoped_refptr<SiteInstance> CreateRelatedSiteInstance(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 787cd81b26508d3e04956721f0e7cec2f457aa60..8e62a5dd26595411757e03078ed0e44646c47a52 100644
|
|
|
+index d15061de5254fd4f248fed92f47a1b1fcf34cd68..62d5e17f0599a78d679495d6fa674939d237602e 100644
|
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
|
-@@ -51,6 +51,20 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info,
|
|
|
+@@ -52,6 +52,20 @@ void OverrideOnBindInterface(const service_manager::BindSourceInfo& remote_info,
|
|
|
handle);
|
|
|
}
|
|
|
|
|
@@ -200,14 +200,14 @@ index 787cd81b26508d3e04956721f0e7cec2f457aa60..8e62a5dd26595411757e03078ed0e446
|
|
|
+ return SiteInstanceForNavigationType::ASK_CHROMIUM;
|
|
|
+}
|
|
|
+
|
|
|
- BrowserMainParts* ContentBrowserClient::CreateBrowserMainParts(
|
|
|
+ std::unique_ptr<BrowserMainParts> ContentBrowserClient::CreateBrowserMainParts(
|
|
|
const MainFunctionParams& parameters) {
|
|
|
return nullptr;
|
|
|
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
|
|
|
-index bf9b3a601fc16d5070e4467a258a047f47b059f3..3c35eddc2498157c2b98bab55991d8aa195954f6 100644
|
|
|
+index 8ceccd96c4e143921ace8db69685a9631e168dd2..136df7edaaaaaa1eb121ef7cf80aebc47969dc8d 100644
|
|
|
--- a/content/public/browser/content_browser_client.h
|
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
|
-@@ -211,8 +211,40 @@ CONTENT_EXPORT void OverrideOnBindInterface(
|
|
|
+@@ -211,8 +211,41 @@ CONTENT_EXPORT void OverrideOnBindInterface(
|
|
|
// the observer interfaces.)
|
|
|
class CONTENT_EXPORT ContentBrowserClient {
|
|
|
public:
|
|
@@ -226,6 +226,7 @@ index bf9b3a601fc16d5070e4467a258a047f47b059f3..3c35eddc2498157c2b98bab55991d8aa
|
|
|
+ // Delegate the site instance creation to Chromium.
|
|
|
+ ASK_CHROMIUM
|
|
|
+ };
|
|
|
++
|
|
|
virtual ~ContentBrowserClient() {}
|
|
|
|
|
|
+ // Electron: Allows disabling the below ShouldOverride patch
|
|
@@ -233,12 +234,12 @@ index bf9b3a601fc16d5070e4467a258a047f47b059f3..3c35eddc2498157c2b98bab55991d8aa
|
|
|
+
|
|
|
+ // Electron: Allows overriding the SiteInstance when navigating.
|
|
|
+ virtual SiteInstanceForNavigationType ShouldOverrideSiteInstanceForNavigation(
|
|
|
-+ content::RenderFrameHost* current_rfh,
|
|
|
-+ content::RenderFrameHost* speculative_rfh,
|
|
|
-+ content::BrowserContext* browser_context,
|
|
|
-+ const GURL& url,
|
|
|
-+ bool has_request_started,
|
|
|
-+ content::SiteInstance** affinity_site_instance) const;
|
|
|
++ content::RenderFrameHost* current_rfh,
|
|
|
++ content::RenderFrameHost* speculative_rfh,
|
|
|
++ content::BrowserContext* browser_context,
|
|
|
++ const GURL& url,
|
|
|
++ bool has_request_started,
|
|
|
++ content::SiteInstance** affinity_site_instance) const;
|
|
|
+
|
|
|
+ // Electron: Registers a pending site instance during a navigation.
|
|
|
+ virtual void RegisterPendingSiteInstance(
|
|
@@ -249,17 +250,17 @@ index bf9b3a601fc16d5070e4467a258a047f47b059f3..3c35eddc2498157c2b98bab55991d8aa
|
|
|
// 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 a3e880e20e51d988175f0e8e2c42e7f5c1740104..61bbf88265e717934533117efbc2330661e32b11 100644
|
|
|
+index a3e880e20e51d988175f0e8e2c42e7f5c1740104..faadd39d01530092f4f31a896ecb60f235e7f63f 100644
|
|
|
--- a/content/public/browser/site_instance.h
|
|
|
+++ b/content/public/browser/site_instance.h
|
|
|
@@ -121,6 +121,11 @@ class CONTENT_EXPORT SiteInstance : public base::RefCounted<SiteInstance> {
|
|
|
// corresponds to a site URL with the host "example.com".
|
|
|
virtual const GURL& GetSiteURL() = 0;
|
|
|
|
|
|
-+ // Create a SiteInstance for the given URL that shares the current
|
|
|
-+ // BrowsingInstance.
|
|
|
-+ virtual scoped_refptr<SiteInstance> CreateRelatedSiteInstance(
|
|
|
-+ const GURL& url) = 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
|