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

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

Issue 2025683003: First experimental implementation of the Clear-Site-Data header (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved channel IDs under 'cookies' Created 4 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_handle_impl.cc
diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc
index da20a1ee15fb52f76dc45c63fd26058e4f232110..520f0a4102e944ed2fd7fa34068e4ac48294615e 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -6,7 +6,9 @@
#include <utility>
+#include "base/command_line.h"
#include "base/logging.h"
+#include "content/browser/browsing_data/clear_site_data_throttle.h"
#include "content/browser/devtools/render_frame_devtools_agent_host.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/navigator.h"
@@ -17,6 +19,7 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/common/browser_side_navigation_policy.h"
#include "content/public/common/content_client.h"
+#include "content/public/common/content_switches.h"
#include "net/url_request/redirect_info.h"
#include "url/gurl.h"
#include "url/url_constants.h"
@@ -31,6 +34,11 @@ void UpdateThrottleCheckResult(
*to_update = result;
}
+bool AreExperimentalFeaturesEnabled() {
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableExperimentalWebPlatformFeatures);
+}
+
} // namespace
// static
@@ -525,7 +533,14 @@ void NavigationHandleImpl::RunCompleteCallback(
}
void NavigationHandleImpl::RegisterNavigationThrottles() {
- // Register the navigation throttles. The ScopedVector returned by
+ // Register the platform's navigation throttles.
+ if (AreExperimentalFeaturesEnabled()) {
+ std::unique_ptr<content::NavigationThrottle> clear_site_data_throttle =
+ content::ClearSiteDataThrottle::CreateThrottleFor(this);
+ throttles_.push_back(std::move(clear_site_data_throttle));
clamy 2016/07/18 14:47:49 If the throttle is put there, it means it will exe
msramek 2016/07/18 17:03:20 Done. Good point - moved it to the end. We haven
+ }
+
+ // Register the embedder's navigation throttles. The ScopedVector returned by
// GetNavigationThrottles is not assigned to throttles_ directly because it
// would overwrite any throttle previously added with
// RegisterThrottleForTesting.

Powered by Google App Engine
This is Rietveld 408576698