Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: content/browser/frame_host/navigation_controller_impl.cc

Issue 1208143002: Move existing kSitePerProcess checks to a policy-oracle object (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@swapped_out_cmdline_checks
Patch Set: Partial fixes to Nasko's comments. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/navigation_controller_impl.cc
diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc
index 321aaeac80253402894b3e0a816d83a00f87001c..e46a2a677fc4154cbc0b581af0b8f2749e0c4a9d 100644
--- a/content/browser/frame_host/navigation_controller_impl.cc
+++ b/content/browser/frame_host/navigation_controller_impl.cc
@@ -72,7 +72,7 @@
#include "content/public/browser/user_metrics.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_constants.h"
-#include "content/public/common/content_switches.h"
+#include "content/public/common/site_isolation_policy.h"
#include "media/base/mime_util.h"
#include "net/base/escape.h"
#include "net/base/net_util.h"
@@ -753,8 +753,7 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) {
// In --site-per-process, create an identical NavigationEntry with a
// new FrameNavigationEntry for the target subframe.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
entry = GetLastCommittedEntry()->Clone();
entry->SetPageID(-1);
entry->AddOrUpdateFrameEntry(node, -1, -1, nullptr, params.url,
@@ -909,8 +908,7 @@ bool NavigationControllerImpl::RendererDidNavigate(
NavigationEntryImpl* active_entry = GetLastCommittedEntry();
active_entry->SetTimestamp(timestamp);
active_entry->SetHttpStatusCode(params.http_status_code);
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
// Update the frame-specific PageState.
FrameNavigationEntry* frame_entry =
active_entry->GetFrameEntry(rfh->frame_tree_node());
@@ -1290,8 +1288,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
// take this out.
//
// Except for cross-process iframes; this doesn't work yet for them.
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
NOTREACHED();
}
@@ -1307,8 +1304,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe(
<< "that a last committed entry exists.";
scoped_ptr<NavigationEntryImpl> new_entry;
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
// Make sure new_entry takes ownership of frame_entry in a scoped_refptr.
FrameNavigationEntry* frame_entry = new FrameNavigationEntry(
rfh->frame_tree_node()->frame_tree_node_id(),
@@ -1363,8 +1359,7 @@ bool NavigationControllerImpl::RendererDidNavigateAutoSubframe(
}
}
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (SiteIsolationPolicy::UseSubframeNavigationEntries()) {
// This may be a "new auto" case where we add a new FrameNavigationEntry, or
// it may be a "history auto" case where we update an existing one.
NavigationEntryImpl* last_committed = GetLastCommittedEntry();
@@ -1817,8 +1812,7 @@ bool NavigationControllerImpl::NavigateToPendingEntryInternal(
// In default Chrome, there are no subframe FrameNavigationEntries. Either
// navigate the main frame or use the main frame's FrameNavigationEntry to
// tell the indicated frame where to go.
- if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kSitePerProcess)) {
+ if (!SiteIsolationPolicy::UseSubframeNavigationEntries()) {
FrameNavigationEntry* frame_entry = GetPendingEntry()->GetFrameEntry(root);
FrameTreeNode* frame = root;
int ftn_id = GetPendingEntry()->frame_tree_node_id();

Powered by Google App Engine
This is Rietveld 408576698