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

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

Issue 2655463006: PlzNavigate: Enforce 'frame-src' CSP on the browser. (Closed)
Patch Set: Addressed comments(alexmos@ and nasko@) Created 3 years, 10 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 74e0b202c6f005ffc79bb32c909b01bb847c83f2..c7066b80fec18c9cfd46c93059c7d702eb5a0120 100644
--- a/content/browser/frame_host/navigation_handle_impl.cc
+++ b/content/browser/frame_host/navigation_handle_impl.cc
@@ -65,11 +65,12 @@ std::unique_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
bool is_same_page,
const base::TimeTicks& navigation_start,
int pending_nav_entry_id,
- bool started_from_context_menu) {
+ bool started_from_context_menu,
+ bool should_bypass_main_world_csp) {
return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl(
url, redirect_chain, frame_tree_node, is_renderer_initiated, is_same_page,
- navigation_start, pending_nav_entry_id,
- started_from_context_menu));
+ navigation_start, pending_nav_entry_id, started_from_context_menu,
+ should_bypass_main_world_csp));
}
NavigationHandleImpl::NavigationHandleImpl(
@@ -80,7 +81,8 @@ NavigationHandleImpl::NavigationHandleImpl(
bool is_same_page,
const base::TimeTicks& navigation_start,
int pending_nav_entry_id,
- bool started_from_context_menu)
+ bool started_from_context_menu,
+ bool should_bypass_main_world_csp)
: url_(url),
has_user_gesture_(false),
transition_(ui::PAGE_TRANSITION_LINK),
@@ -109,6 +111,7 @@ NavigationHandleImpl::NavigationHandleImpl(
started_from_context_menu_(started_from_context_menu),
reload_type_(ReloadType::NONE),
navigation_type_(NAVIGATION_TYPE_UNKNOWN),
+ should_bypass_main_world_csp_(should_bypass_main_world_csp),
weak_factory_(this) {
DCHECK(!navigation_start.is_null());
if (redirect_chain_.empty())
@@ -456,6 +459,10 @@ NavigationData* NavigationHandleImpl::GetNavigationData() {
return navigation_data_.get();
}
+bool NavigationHandleImpl::ShouldBypassMainWorldCSP() const {
alexmos 2017/02/14 06:57:20 nit: you can move this simple getter into to the h
arthursonzogni 2017/02/15 09:26:09 Done, but I can't move the implementation in the h
alexmos 2017/02/24 06:40:27 Ack, though that's surprising to me, as should_byp
arthursonzogni 2017/02/24 16:13:29 You are right, after this change, I removed the "o
+ return should_bypass_main_world_csp_;
+}
+
const GlobalRequestID& NavigationHandleImpl::GetGlobalRequestID() {
DCHECK(state_ == WILL_PROCESS_RESPONSE || state_ == DEFERRING_RESPONSE ||
state_ == READY_TO_COMMIT);
@@ -663,9 +670,9 @@ NavigationHandleImpl::CheckWillStartRequest() {
case NavigationThrottle::PROCEED:
continue;
+ case NavigationThrottle::BLOCK_REQUEST:
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
- case NavigationThrottle::BLOCK_REQUEST:
state_ = CANCELING;
return result;
@@ -695,6 +702,7 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
case NavigationThrottle::PROCEED:
continue;
+ case NavigationThrottle::BLOCK_REQUEST:
case NavigationThrottle::CANCEL:
case NavigationThrottle::CANCEL_AND_IGNORE:
state_ = CANCELING;
@@ -705,7 +713,6 @@ NavigationHandleImpl::CheckWillRedirectRequest() {
next_index_ = i + 1;
return result;
- case NavigationThrottle::BLOCK_REQUEST:
case NavigationThrottle::BLOCK_RESPONSE:
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698