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

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

Issue 1617043002: Introduce AncestorThrottle, which will process 'X-Frame-Options' headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@block-response
Patch Set: Created 4 years, 11 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 de17b3247fe2833c2391349fcde9bb32c57d688e..b9a646ef300003fc0564027d4e3b9974532ec6af 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "content/browser/frame_host/ancestor_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"
@@ -233,10 +234,13 @@ void NavigationHandleImpl::WillStartRequest(
state_ = WILL_SEND_REQUEST;
complete_callback_ = callback;
- // Register the navigation throttles. The ScopedVector returned by
- // GetNavigationThrottles is not assigned to throttles_ directly because it
- // would overwrite any throttle previously added with
- // RegisterThrottleForTesting.
+ // Register the platform's navigation throttles.
+ scoped_ptr<content::NavigationThrottle> ancestor_throttle =
+ AncestorThrottle::MaybeCreateThrottleFor(this);
+ if (ancestor_throttle)
+ throttles_.push_back(std::move(ancestor_throttle));
+
+ // Register the embedder's navigation throttles.
ScopedVector<NavigationThrottle> throttles_to_register =
GetContentClient()->browser()->CreateThrottlesForNavigation(this);
if (throttles_to_register.size() > 0) {
@@ -343,7 +347,7 @@ NavigationHandleImpl::CheckWillStartRequest() {
next_index_ = i + 1;
return result;
- default:
+ case NavigationThrottle::BLOCK_RESPONSE:
nasko 2016/02/12 23:21:40 Why did we lose the default?
Mike West 2016/04/12 20:13:30 Because this completely enumerates all the options
NOTREACHED();
}
}
@@ -374,7 +378,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
next_index_ = i + 1;
return result;
- default:
+ case NavigationThrottle::BLOCK_RESPONSE:
NOTREACHED();
}
}
@@ -393,6 +397,7 @@ NavigationHandleImpl::CheckWillProcessResponse() {
case NavigationThrottle::PROCEED:
continue;
+ case NavigationThrottle::BLOCK_RESPONSE:
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
state_ = CANCELING;

Powered by Google App Engine
This is Rietveld 408576698