Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index 14f079e13725cf36bff014b6c78b199bf259bdff..1bd3039c4036297c2230838ad211b6a83220c9ad 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -19,6 +19,7 @@ |
#include "base/lazy_instance.h" |
#include "base/macros.h" |
#include "base/memory/ptr_util.h" |
+#include "base/metrics/field_trial_params.h" |
#include "base/metrics/histogram_macros.h" |
#include "base/path_service.h" |
#include "base/strings/string_number_conversions.h" |
@@ -57,6 +58,7 @@ |
#include "chrome/browser/notifications/platform_notification_service_impl.h" |
#include "chrome/browser/page_load_metrics/experiments/delay_navigation_throttle.h" |
#include "chrome/browser/page_load_metrics/metrics_navigation_throttle.h" |
+#include "chrome/browser/page_load_metrics/observers/ads_detection.h" |
#include "chrome/browser/password_manager/chrome_password_manager_client.h" |
#include "chrome/browser/permissions/permission_context_base.h" |
#include "chrome/browser/platform_util.h" |
@@ -1333,20 +1335,37 @@ void ChromeContentBrowserClient::OverrideNavigationParams( |
#endif |
} |
-bool ChromeContentBrowserClient:: |
- ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( |
- const GURL& url, |
- content::SiteInstance* parent_site_instance) { |
- if (IsNTPSiteInstance(parent_site_instance)) |
- return true; |
+bool ChromeContentBrowserClient::ShouldIsolateFrameForTopDocumentIsolation( |
+ content::RenderFrameHost* frame, |
+ const GURL& dest_url, |
+ content::SiteInstance* main_frame_site_instance) { |
+ if (IsNTPSiteInstance(main_frame_site_instance)) |
+ return false; |
#if BUILDFLAG(ENABLE_EXTENSIONS) |
- return ChromeContentBrowserClientExtensionsPart:: |
- ShouldFrameShareParentSiteInstanceDespiteTopDocumentIsolation( |
- url, parent_site_instance); |
-#else |
- return false; |
+ if (ChromeContentBrowserClientExtensionsPart:: |
+ IsMainFrameSiteInstanceExcludedFromTopDocumentIsolation( |
+ main_frame_site_instance)) |
Alexei Svitkine (slow)
2017/07/07 16:55:05
Nit: {}
Łukasz Anforowicz
2017/07/07 20:41:42
Done.
|
+ return false; |
#endif |
+ |
+ features::TopDocumentIsolationMode tdiMode = |
+ static_cast<features::TopDocumentIsolationMode>( |
+ base::GetFieldTrialParamByFeatureAsInt( |
+ ::features::kTopDocumentIsolation, |
+ ::features::kTopDocumentIsolationModeParam, |
+ static_cast<int>( |
+ features::TopDocumentIsolationMode::Unspecified))); |
+ switch (tdiMode) { |
+ case features::TopDocumentIsolationMode::Unspecified: |
+ case features::TopDocumentIsolationMode::Ads: |
+ return IsAdFrame(frame->GetFrameName(), dest_url); |
+ |
+ case features::TopDocumentIsolationMode::CrossSite: |
+ return true; |
+ } |
+ NOTREACHED(); |
+ return false; |
} |
bool ChromeContentBrowserClient::IsSuitableHost( |