69f1731bbb
* chore: bump chromium in DEPS to cbdeef954dfc34e94c8ca9cf72ad326b4a121158 * chore: bump chromium in DEPS to 29723f905baeab1d4228eef2c31cdb341ebeffe0 * chore: bump chromium in DEPS to 44d6d78e852137fff58c14ed26ab1e803e5bf822 * update patches * chore: bump chromium in DEPS to 8a3a0fccb39d6b8334c9a0496c0d5056e50cdb3f * chore: update patches * refactor: fix PrintBackend::CreateInstance() calls Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2354541 * chore: bump chromium in DEPS to b9ebec3bcb1cabdd1426f367636f54cc98e0500e * chore: remove patches to code that was deleted upstream CL: https://chromium-review.googlesource.com/c/chromium/src/+/2360314 * Remove uses of kCGColorSpaceITUR_2020_PQ_EOTF/HLG CL: https://chromium-review.googlesource.com/c/chromium/src/+/2363950 just garden variety code shear * chore: update patch indices * Move ColorModel to //printing/mojom/print.mojom https://chromium-review.googlesource.com/c/chromium/src/+/2355083 sync with printing ColorModel changes: moved to mojo, different naming scheme * chore: bump chromium in DEPS to 56c4b4d2ce5ba941acd2e0fdb5100e8a48847134 * chore: bump chromium in DEPS to 130501f220b684a79dc82c17e236e63ac1f2a093 * Convert PrintHostMsg_DidGetPrintedPagesCount to Mojo https://chromium-review.googlesource.com/c/chromium/src/+/2326857 Update argument list to Print() * chore: update patch indices * DumpAccTree: convert utf16 to utf8 in PropertyFilter https://chromium-review.googlesource.com/c/chromium/src/+/2360218 * chore: bump chromium in DEPS to 3058368c6646e0dc8be6f8ea838b0343428b7998 * chore: bump chromium in DEPS to f51b4e6555364363c61438dac7afd988c8347bfc * chore: bump chromium in DEPS to 2dcc6f8fc23ac41b2499eb69dee0b4017e9d1046 * update patches * chore: bump chromium in DEPS to 2d8e98ecedc7e4905540b053bc1c87e964715be5 * update patches * 2345900: Move content::RecordContentToVisibleTimeRequest struct to mojo https://chromium-review.googlesource.com/c/chromium/src/+/2345900 * update patches * 2345900: Move content::RecordContentToVisibleTimeRequest struct to mojo https://chromium-review.googlesource.com/c/chromium/src/+/2345900 * 2367394: Remove net::LOAD_DO_NOT_SEND_COOKIES and net::LOAD_DO_NOT_SEND_AUTH_DATA. https://chromium-review.googlesource.com/c/chromium/src/+/2367394 * 2373227: [XProto] Consolidate all <X11/*> includes to //ui/gfx/x/x11.h https://chromium-review.googlesource.com/c/chromium/src/+/2373227 * fixup! 2373227: [XProto] Consolidate all <X11/*> includes to //ui/gfx/x/x11.h * chore: bump chromium in DEPS to c090e3f960520cbd2328608b97f87238c76d6143 * update patches * chore: bump chromium in DEPS to 13a25e0a755de9a14271022c595f3d2e29829e1a * chore: bump chromium in DEPS to 6adbb767b012c41efaeab0d1bdbb3eefed0977bc * chore: bump chromium in DEPS to 339ec5455c5932ef1322ea9953a6349b0732199e * chore: bump chromium in DEPS to 20291807c33f7ef4ef4f57d62075e099b027bfe6 * chore: bump chromium in DEPS to 226fbd1b8b17d4ac84fdb9548ef3a1c646878d47 * update patches * fixup disable_color_correct_rendering patch * chore: bump chromium in DEPS to 577c45979cad4359f2e206d68efd9317d3d79315 * update patches * viz: Rename RenderPass to CompositorRenderPass (and related types). https://chromium-review.googlesource.com/c/chromium/src/+/2380730 * chore: bump chromium in DEPS to 37e2ad5303f2c03a1b5d8eda65341bf2561196cd * update patches * add kOmitCookies_Electron * update patch * chore: bump chromium in DEPS to 256e42409ea63a7e71016de07818a983a97db463 * update patches * fix worker script ready hook https://chromium-review.googlesource.com/c/chromium/src/+/2335713 * Fixup printing page ranges patch * [printing] Move PrintMsg_PrintPages_Params to print.mojom https://chromium-review.googlesource.com/c/chromium/src/+/2340854 * Add MIME sniffer overloads that take base::StringPieces https://chromium-review.googlesource.com/c/chromium/src/+/2382896 * [printing] Move PrintHostMsg_PreviewIds to print.mojom https://chromium-review.googlesource.com/c/chromium/src/+/2379455 * fixup test due to new DCHECK https://chromium-review.googlesource.com/c/chromium/src/+/2333750 * stop sending cookies when useSessionCookies is false * chore: bump chromium in DEPS to dd429dbc556449951ee8160d8a4d61fd95a139d5 * update patches * chore: bump chromium in DEPS to 5202bde3f9f44c2065f5dacf27e7000dd19e4e4d * chore: bump chromium in DEPS to 099e8e07b89da65932431bb0fd51b6f7f5344c19 * chore: bump chromium in DEPS to 104e5da2a43b759732d5b94bfc750b3a9a639653 * chore: bump chromium in DEPS to a4519ce657af25834e355315fd7fefa77b13426a * update patches * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 * chore: bump chromium in DEPS to 1b62e9e8c8eaf6b8e3a9c77ee67a4c1bfa6a4d6b * chore: update patches * fixup! Make FileURLLoaderFactory always owned by its |receivers_|. * chore: update patches - mac: Disable CoreServices _CSCheckFix. https://chromium-review.googlesource.com/c/chromium/src/+/2401334 - [XProto] Remove bad DCHECK in x11_error_tracker.cc https://chromium-review.googlesource.com/c/chromium/src/+/2402304 - Move content/browser/frame_host/* over to content/browser/renderer_host/ https://chromium-review.googlesource.com/c/chromium/src/+/2401303 * Refactor WebContentSettingsClient to dedupe AllowXYZ methods https://chromium-review.googlesource.com/c/chromium/src/+/2353552 * Introduce NonNetworkURLLoaderFactoryBase class. https://chromium-review.googlesource.com/c/chromium/src/+/2357559 * [XProto] Remove usage of all Xlib headers https://chromium-review.googlesource.com/c/chromium/src/+/2392140 * fixup! chore: update patches * chore: bump chromium in DEPS to c1df55fbeb8207d036a604f59e4ea4e8ee79930a * chore: update patches * Move content::WebPreferences struct to Blink https://chromium-review.googlesource.com/c/chromium/src/+/2397670 * chore: bump chromium in DEPS to 57a23ec4884fff6c2f8d9b8536131cdc9b551ec2 * Set appid on Pip windows. https://chromium-review.googlesource.com/c/chromium/src/+/2388274 * fixup! Set appid on Pip windows. * fix: add a patch to remove deprecated factory * chore: bump chromium in DEPS to 1a9ddb7ea43955877823d5c4dcbf241b64228635 * fix compilation on windows * chore: bump chromium in DEPS to 234e6c6a77f61ffad9335099d9b13892cf88fd44 * chore: update patches * chore: bump chromium in DEPS to 7631eb0a9f57a8a47d3c28e1d265961b3a4d6b2b * chore: update patches * chore: bump chromium in DEPS to f9c34cd485845b95c2d17a7f55fdf92cda9a1b3a * chore: update patches * chore: implement GetSurveyAPIKey Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2362182 * chore: replace CreateWebUIURLLoader with CreateWebUIURLLoaderFactory Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2358309 * chore: bump chromium in DEPS to 5bdbd2373da884adf41c087be1465fcc344d168c * chore: update node patches for common.gypi * chore: update patches * chore: non_network_url_loader_factory_base was moved Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2357431 * 2415752: Reland "Reland "OOR-CORS: Remove BlinkCORS supporting code outside Blink"" Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415752 * chore: bump chromium in DEPS to b943d006a33ec5bc1743792d64724693eb357083 * fix: replace x11::None with x11::Window::None * chore: update patches * chore: update patches * fix: cast x11::Window to int * 2402123: Use end date when deleting http auth cache Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2402123 * 2320268: Migrate DragHostMsg_StartDragging to Mojo Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2320268 * 2401303: Move content/browser/frame_host/* over to content/browser/renderer_host/ https://chromium-review.googlesource.com/c/chromium/src/+/2401303 * chore: fix lint * chore: fix build * Update config.yml Co-authored-by: Electron Bot <anonymous@electronjs.org> Co-authored-by: Charles Kerr <charles@charleskerr.com> Co-authored-by: Jeremy Rose <nornagon@nornagon.net> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Samuel Attard <sattard@slack-corp.com>
322 lines
15 KiB
Diff
322 lines
15 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
Date: Mon, 3 Jun 2019 14:20:05 -0700
|
|
Subject: frame_host_manager.patch
|
|
|
|
Allows embedder to intercept site instances chosen by chromium
|
|
and respond with custom instance. Also allows for us to at-runtime
|
|
enable or disable this patch.
|
|
|
|
diff --git a/content/browser/browsing_instance.cc b/content/browser/browsing_instance.cc
|
|
index b5a6cce52d5a49d52e40f4806adc58704f186a3e..e9d94fe452b655382db62125758f9f73b10c29a0 100644
|
|
--- a/content/browser/browsing_instance.cc
|
|
+++ b/content/browser/browsing_instance.cc
|
|
@@ -91,6 +91,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;
|
|
+}
|
|
+
|
|
SiteInfo BrowsingInstance::GetSiteInfoForURL(const GURL& url,
|
|
bool allow_default_instance) {
|
|
scoped_refptr<SiteInstanceImpl> site_instance =
|
|
diff --git a/content/browser/browsing_instance.h b/content/browser/browsing_instance.h
|
|
index bc0c8821f6a871a5d09f6e9fd97f52abe126370b..06a6b7805f710be51c84a3882922d9602cd7d80d 100644
|
|
--- a/content/browser/browsing_instance.h
|
|
+++ b/content/browser/browsing_instance.h
|
|
@@ -148,6 +148,11 @@ class CONTENT_EXPORT BrowsingInstance final
|
|
const GURL& url,
|
|
bool allow_default_instance);
|
|
|
|
+ // 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/renderer_host/navigation_request.cc b/content/browser/renderer_host/navigation_request.cc
|
|
index 6c6e3f5d11a480c18e4fbe92f163315b4deac4fb..9ccda32152c2d16cd5ca6eeaafd96adcb6adf25c 100644
|
|
--- a/content/browser/renderer_host/navigation_request.cc
|
|
+++ b/content/browser/renderer_host/navigation_request.cc
|
|
@@ -1394,6 +1394,21 @@ void NavigationRequest::BeginNavigation() {
|
|
// it immediately.
|
|
EnterChildTraceEvent("ResponseStarted", this);
|
|
|
|
+ // In Electron, a new process is started for every navigation when node is
|
|
+ // integrated in the renderer. Since GetFrameHostForNavigation is called more
|
|
+ // than once per navigation, we want to return the same frame host once
|
|
+ // the response has started, otherwise if the frame host that started the response
|
|
+ // and the frame host that is available for commit don't match then request will
|
|
+ // be cancelled. We rely on the NavigationRequest::state_ to determine this
|
|
+ // factor
|
|
+ //
|
|
+ // bool has_response_started =
|
|
+ // (request->state() >= NavigationRequest::WILL_PROCESS_RESPONSE &&
|
|
+ // !speculative_render_frame_host_);
|
|
+ //
|
|
+ // Hence this call is necesary before the call to GetFrameHostForNavigation.
|
|
+ SetState(REUSE_SITE_INSTANCE);
|
|
+
|
|
// Select an appropriate RenderFrameHost.
|
|
render_frame_host_ =
|
|
frame_tree_node_->render_manager()->GetFrameHostForNavigation(this);
|
|
@@ -5010,6 +5025,7 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const {
|
|
{WILL_START_REQUEST, {
|
|
WILL_REDIRECT_REQUEST,
|
|
WILL_PROCESS_RESPONSE,
|
|
+ REUSE_SITE_INSTANCE,
|
|
READY_TO_COMMIT,
|
|
DID_COMMIT,
|
|
CANCELING,
|
|
@@ -5023,10 +5039,14 @@ void NavigationRequest::CheckStateTransition(NavigationState state) const {
|
|
WILL_FAIL_REQUEST,
|
|
}},
|
|
{WILL_PROCESS_RESPONSE, {
|
|
+ REUSE_SITE_INSTANCE,
|
|
READY_TO_COMMIT,
|
|
CANCELING,
|
|
WILL_FAIL_REQUEST,
|
|
}},
|
|
+ {REUSE_SITE_INSTANCE, {
|
|
+ READY_TO_COMMIT,
|
|
+ }},
|
|
{READY_TO_COMMIT, {
|
|
NOT_STARTED,
|
|
DID_COMMIT,
|
|
diff --git a/content/browser/renderer_host/navigation_request.h b/content/browser/renderer_host/navigation_request.h
|
|
index 0cafd8ae4f3c1f3405ede5f007e10a40d0949f45..57bd0caaad84de4420f3f4249b16ea4a1a8821ff 100644
|
|
--- a/content/browser/renderer_host/navigation_request.h
|
|
+++ b/content/browser/renderer_host/navigation_request.h
|
|
@@ -129,6 +129,10 @@ class CONTENT_EXPORT NavigationRequest
|
|
// asynchronous.
|
|
WILL_PROCESS_RESPONSE,
|
|
|
|
+ // Electron: state that is between than WILL_PROCESS_RESPONSE and
|
|
+ // READY_TO_COMMIT to force reuse the same site instance.
|
|
+ REUSE_SITE_INSTANCE,
|
|
+
|
|
// The response started on the IO thread and is ready to be committed.
|
|
READY_TO_COMMIT,
|
|
|
|
diff --git a/content/browser/renderer_host/render_frame_host_manager.cc b/content/browser/renderer_host/render_frame_host_manager.cc
|
|
index abe9ae05e7b505c8c0cddbee7bf3d5e186548458..bf58d0f65e161e61d8303f5652f2d348ba2cbd6a 100644
|
|
--- a/content/browser/renderer_host/render_frame_host_manager.cc
|
|
+++ b/content/browser/renderer_host/render_frame_host_manager.cc
|
|
@@ -2550,6 +2550,16 @@ void RenderFrameHostManager::GetCoopCoepCrossOriginIsolationInfo(
|
|
scoped_refptr<SiteInstance>
|
|
RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
NavigationRequest* request) {
|
|
+ // Compute the SiteInstance that the navigation should use, which will be
|
|
+ // either the current SiteInstance or a new one.
|
|
+ //
|
|
+ // TODO(clamy): We should also consider as a candidate SiteInstance the
|
|
+ // speculative SiteInstance that was computed on redirects.
|
|
+ SiteInstanceImpl* candidate_site_instance =
|
|
+ speculative_render_frame_host_
|
|
+ ? speculative_render_frame_host_->GetSiteInstance()
|
|
+ : nullptr;
|
|
+
|
|
SiteInstance* current_site_instance = render_frame_host_->GetSiteInstance();
|
|
|
|
// All children of MHTML documents must be MHTML documents. They all live in
|
|
@@ -2569,10 +2579,60 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
//
|
|
// TODO(clamy): We should also consider as a candidate SiteInstance the
|
|
// speculative SiteInstance that was computed on redirects.
|
|
- SiteInstanceImpl* candidate_site_instance =
|
|
- speculative_render_frame_host_
|
|
- ? speculative_render_frame_host_->GetSiteInstance()
|
|
- : nullptr;
|
|
+ if (!GetContentClient()->browser()->CanUseCustomSiteInstance() &&
|
|
+ frame_tree_node_->IsMainFrame()) {
|
|
+ BrowserContext* browser_context =
|
|
+ delegate_->GetControllerForRenderManager().GetBrowserContext();
|
|
+ bool has_navigation_started = request->state() != NavigationRequest::NOT_STARTED;
|
|
+ bool has_response_started =
|
|
+ (request->state() >= NavigationRequest::WILL_PROCESS_RESPONSE &&
|
|
+ !speculative_render_frame_host_);
|
|
+ // Gives user a chance to choose a custom site instance.
|
|
+ SiteInstance* affinity_site_instance = nullptr;
|
|
+ scoped_refptr<SiteInstance> overriden_site_instance;
|
|
+ bool should_register_site_instance = false;
|
|
+ ContentBrowserClient::SiteInstanceForNavigationType siteInstanceType =
|
|
+ GetContentClient()->browser()->ShouldOverrideSiteInstanceForNavigation(
|
|
+ current_frame_host(), speculative_frame_host(), browser_context,
|
|
+ request->common_params().url, has_navigation_started,
|
|
+ has_response_started, &affinity_site_instance);
|
|
+ switch (siteInstanceType) {
|
|
+ case ContentBrowserClient::SiteInstanceForNavigationType::
|
|
+ FORCE_CANDIDATE_OR_NEW:
|
|
+ overriden_site_instance =
|
|
+ candidate_site_instance
|
|
+ ? candidate_site_instance
|
|
+ : current_site_instance->CreateRelatedSiteInstance(
|
|
+ request->common_params().url);
|
|
+ should_register_site_instance = true;
|
|
+ break;
|
|
+ case ContentBrowserClient::SiteInstanceForNavigationType::FORCE_NEW:
|
|
+ overriden_site_instance = current_site_instance->CreateRelatedSiteInstance(
|
|
+ request->common_params().url);
|
|
+ should_register_site_instance = true;
|
|
+ break;
|
|
+ case ContentBrowserClient::SiteInstanceForNavigationType::FORCE_CURRENT:
|
|
+ overriden_site_instance = render_frame_host_->GetSiteInstance();
|
|
+ break;
|
|
+ case ContentBrowserClient::SiteInstanceForNavigationType::FORCE_AFFINITY:
|
|
+ DCHECK(affinity_site_instance);
|
|
+ overriden_site_instance =
|
|
+ scoped_refptr<SiteInstance>(affinity_site_instance);
|
|
+ break;
|
|
+ case ContentBrowserClient::SiteInstanceForNavigationType::ASK_CHROMIUM:
|
|
+ DCHECK(!affinity_site_instance);
|
|
+ break;
|
|
+ default:
|
|
+ break;
|
|
+ }
|
|
+ if (overriden_site_instance) {
|
|
+ if (should_register_site_instance) {
|
|
+ GetContentClient()->browser()->RegisterPendingSiteInstance(
|
|
+ render_frame_host_.get(), overriden_site_instance.get());
|
|
+ }
|
|
+ return overriden_site_instance;
|
|
+ }
|
|
+ }
|
|
|
|
// Account for renderer-initiated reload as well.
|
|
// Needed as a workaround for https://crbug.com/1045524, remove it when it is
|
|
@@ -2615,6 +2675,9 @@ RenderFrameHostManager::GetSiteInstanceForNavigationRequest(
|
|
request->ResetStateForSiteInstanceChange();
|
|
}
|
|
|
|
+ GetContentClient()->browser()->RegisterPendingSiteInstance(
|
|
+ render_frame_host_.get(), dest_site_instance.get());
|
|
+
|
|
return dest_site_instance;
|
|
}
|
|
|
|
diff --git a/content/browser/site_instance_impl.cc b/content/browser/site_instance_impl.cc
|
|
index ed973ac9ee40abc70ead81fba83573592dfd3efc..40c57cadaae712495bf28f0065ff4751c06629db 100644
|
|
--- a/content/browser/site_instance_impl.cc
|
|
+++ b/content/browser/site_instance_impl.cc
|
|
@@ -600,6 +600,10 @@ bool SiteInstanceImpl::HasRelatedSiteInstance(const SiteInfo& site_info) {
|
|
return browsing_instance_->HasSiteInstance(site_info);
|
|
}
|
|
|
|
+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(
|
|
diff --git a/content/browser/site_instance_impl.h b/content/browser/site_instance_impl.h
|
|
index ecebcc5d30f66ef30325bb3cc0b367d3d9de2c82..f1a27bf06e416d876efe095f6f81acf26183fb83 100644
|
|
--- a/content/browser/site_instance_impl.h
|
|
+++ b/content/browser/site_instance_impl.h
|
|
@@ -231,6 +231,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;
|
|
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 ca22e2dbdfbd4b4c3bf60464cbdcd2104cbe5a7e..03f669bd50213946355bd9d16bc44efd4ef7e9b3 100644
|
|
--- a/content/public/browser/content_browser_client.cc
|
|
+++ b/content/public/browser/content_browser_client.cc
|
|
@@ -63,6 +63,21 @@
|
|
|
|
namespace content {
|
|
|
|
+bool ContentBrowserClient::CanUseCustomSiteInstance() {
|
|
+ return false;
|
|
+}
|
|
+
|
|
+ContentBrowserClient::SiteInstanceForNavigationType ContentBrowserClient::ShouldOverrideSiteInstanceForNavigation(
|
|
+ content::RenderFrameHost* current_rfh,
|
|
+ content::RenderFrameHost* speculative_rfh,
|
|
+ content::BrowserContext* browser_context,
|
|
+ const GURL& url,
|
|
+ bool has_navigation_started,
|
|
+ bool has_request_started,
|
|
+ content::SiteInstance** affinity_site_instance) const {
|
|
+ return SiteInstanceForNavigationType::ASK_CHROMIUM;
|
|
+}
|
|
+
|
|
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 bd81fcd224d4cad545265be2dd1fa4a65b3248eb..f0fb9e8b9db4078c53ba6baa16812c838943d0f7 100644
|
|
--- a/content/public/browser/content_browser_client.h
|
|
+++ b/content/public/browser/content_browser_client.h
|
|
@@ -252,8 +252,45 @@ class CONTENT_EXPORT ContentBrowserClient {
|
|
using IsClipboardPasteAllowedCallback =
|
|
base::OnceCallback<void(ClipboardPasteAllowed)>;
|
|
|
|
+ // Identifies the type of site instance to use for a navigation.
|
|
+ enum SiteInstanceForNavigationType {
|
|
+ // Use either the candidate site instance or, if it doesn't exist
|
|
+ // a new, unrelated site instance for the navigation.
|
|
+ FORCE_CANDIDATE_OR_NEW = 0,
|
|
+
|
|
+ // Use the current site instance for the navigation.
|
|
+ FORCE_CURRENT,
|
|
+
|
|
+ // Use a new, unrelated site instance.
|
|
+ FORCE_NEW,
|
|
+
|
|
+ // Use the provided affinity site instance for the navigation.
|
|
+ FORCE_AFFINITY,
|
|
+
|
|
+ // Delegate the site instance creation to Chromium.
|
|
+ ASK_CHROMIUM
|
|
+ };
|
|
+
|
|
virtual ~ContentBrowserClient() {}
|
|
|
|
+ // Electron: Allows disabling the below ShouldOverride patch
|
|
+ virtual bool CanUseCustomSiteInstance();
|
|
+
|
|
+ // 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_navigation_started,
|
|
+ bool has_request_started,
|
|
+ content::SiteInstance** affinity_site_instance) const;
|
|
+
|
|
+ // Electron: Registers a pending site instance during a navigation.
|
|
+ virtual void RegisterPendingSiteInstance(
|
|
+ content::RenderFrameHost* rfh,
|
|
+ content::SiteInstance* pending_site_instance) {}
|
|
+
|
|
// 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 0e6c3d076a02cd1b356745e514b9de9d32e4b00c..76647f1c5e9ee401fbf3def6ccfe73372f622548 100644
|
|
--- a/content/public/browser/site_instance.h
|
|
+++ b/content/public/browser/site_instance.h
|
|
@@ -134,6 +134,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;
|
|
+
|
|
// 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
|