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) |
<< "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. |