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

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: Compilation fixes. Created 4 years, 6 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
« no previous file with comments | « content/browser/browsing_data/clear_site_data_throttle_unittest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 90e06f1c7327fa2255f7b40039de183d1ba86b71..76d75703e6b088b0b4f16d58fc0a298d2d930dbd 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/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/navigator.h"
#include "content/browser/frame_host/navigator_delegate.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
@@ -183,9 +191,9 @@ net::Error NavigationHandleImpl::GetNetErrorCode() {
}
RenderFrameHostImpl* NavigationHandleImpl::GetRenderFrameHost() {
- CHECK(state_ >= READY_TO_COMMIT)
+ CHECK(state_ >= WILL_PROCESS_RESPONSE)
melandory 2016/06/15 08:12:34 also fix comment in navigation_handle.h (see here
msramek 2016/06/15 18:00:40 Done. I have updated the comment, but I didn't exa
<< "This accessor should only be called "
- "after the navigation is ready to commit.";
+ "after a response has been received.";
return render_frame_host_;
}
@@ -328,7 +336,14 @@ void NavigationHandleImpl::WillStartRequest(
state_ = WILL_SEND_REQUEST;
complete_callback_ = callback;
- // 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));
+ }
+
+ // 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.
« no previous file with comments | « content/browser/browsing_data/clear_site_data_throttle_unittest.cc ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698