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

Side by Side Diff: content/browser/frame_host/navigation_handle_impl.cc

Issue 2411693003: Move blocking of top-level navigations to nested URLs with extension origins from non-extension pro… (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/frame_host/navigation_handle_impl.h" 5 #include "content/browser/frame_host/navigation_handle_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/debug/dump_without_crashing.h" 9 #include "base/debug/dump_without_crashing.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 26 matching lines...) Expand all
37 NavigationThrottle::ThrottleCheckResult* to_update, 37 NavigationThrottle::ThrottleCheckResult* to_update,
38 NavigationThrottle::ThrottleCheckResult result) { 38 NavigationThrottle::ThrottleCheckResult result) {
39 *to_update = result; 39 *to_update = result;
40 } 40 }
41 41
42 } // namespace 42 } // namespace
43 43
44 // static 44 // static
45 std::unique_ptr<NavigationHandleImpl> NavigationHandleImpl::Create( 45 std::unique_ptr<NavigationHandleImpl> NavigationHandleImpl::Create(
46 const GURL& url, 46 const GURL& url,
47 const GURL& site_url,
47 FrameTreeNode* frame_tree_node, 48 FrameTreeNode* frame_tree_node,
48 bool is_renderer_initiated, 49 bool is_renderer_initiated,
49 bool is_synchronous, 50 bool is_synchronous,
50 bool is_srcdoc, 51 bool is_srcdoc,
51 const base::TimeTicks& navigation_start, 52 const base::TimeTicks& navigation_start,
52 int pending_nav_entry_id, 53 int pending_nav_entry_id,
53 bool started_from_context_menu) { 54 bool started_from_context_menu) {
54 return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl( 55 return std::unique_ptr<NavigationHandleImpl>(new NavigationHandleImpl(
55 url, frame_tree_node, is_renderer_initiated, is_synchronous, is_srcdoc, 56 url, site_url, frame_tree_node, is_renderer_initiated, is_synchronous,
56 navigation_start, pending_nav_entry_id, started_from_context_menu)); 57 is_srcdoc, navigation_start, pending_nav_entry_id,
58 started_from_context_menu));
57 } 59 }
58 60
59 NavigationHandleImpl::NavigationHandleImpl( 61 NavigationHandleImpl::NavigationHandleImpl(
60 const GURL& url, 62 const GURL& url,
63 const GURL& site_url,
61 FrameTreeNode* frame_tree_node, 64 FrameTreeNode* frame_tree_node,
62 bool is_renderer_initiated, 65 bool is_renderer_initiated,
63 bool is_synchronous, 66 bool is_synchronous,
64 bool is_srcdoc, 67 bool is_srcdoc,
65 const base::TimeTicks& navigation_start, 68 const base::TimeTicks& navigation_start,
66 int pending_nav_entry_id, 69 int pending_nav_entry_id,
67 bool started_from_context_menu) 70 bool started_from_context_menu)
68 : url_(url), 71 : url_(url),
72 site_url_(site_url),
69 has_user_gesture_(false), 73 has_user_gesture_(false),
70 transition_(ui::PAGE_TRANSITION_LINK), 74 transition_(ui::PAGE_TRANSITION_LINK),
71 is_external_protocol_(false), 75 is_external_protocol_(false),
72 net_error_code_(net::OK), 76 net_error_code_(net::OK),
73 render_frame_host_(nullptr), 77 render_frame_host_(nullptr),
74 is_renderer_initiated_(is_renderer_initiated), 78 is_renderer_initiated_(is_renderer_initiated),
75 is_same_page_(false), 79 is_same_page_(false),
76 is_synchronous_(is_synchronous), 80 is_synchronous_(is_synchronous),
77 is_srcdoc_(is_srcdoc), 81 is_srcdoc_(is_srcdoc),
78 was_redirected_(false), 82 was_redirected_(false),
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 125
122 RequestContextType NavigationHandleImpl::GetRequestContextType() const { 126 RequestContextType NavigationHandleImpl::GetRequestContextType() const {
123 DCHECK_GE(state_, WILL_SEND_REQUEST); 127 DCHECK_GE(state_, WILL_SEND_REQUEST);
124 return request_context_type_; 128 return request_context_type_;
125 } 129 }
126 130
127 const GURL& NavigationHandleImpl::GetURL() { 131 const GURL& NavigationHandleImpl::GetURL() {
128 return url_; 132 return url_;
129 } 133 }
130 134
135 const GURL& NavigationHandleImpl::GetSiteURL() {
136 return site_url_;
137 }
138
131 bool NavigationHandleImpl::IsInMainFrame() { 139 bool NavigationHandleImpl::IsInMainFrame() {
132 return frame_tree_node_->IsMainFrame(); 140 return frame_tree_node_->IsMainFrame();
133 } 141 }
134 142
135 bool NavigationHandleImpl::IsParentMainFrame() { 143 bool NavigationHandleImpl::IsParentMainFrame() {
136 if (frame_tree_node_->parent()) 144 if (frame_tree_node_->parent())
137 return frame_tree_node_->parent()->IsMainFrame(); 145 return frame_tree_node_->parent()->IsMainFrame();
138 146
139 return false; 147 return false;
140 } 148 }
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 throttles_to_register.end()); 753 throttles_to_register.end());
746 throttles_to_register.weak_clear(); 754 throttles_to_register.weak_clear();
747 } 755 }
748 } 756 }
749 757
750 bool NavigationHandleImpl::WasStartedFromContextMenu() const { 758 bool NavigationHandleImpl::WasStartedFromContextMenu() const {
751 return started_from_context_menu_; 759 return started_from_context_menu_;
752 } 760 }
753 761
754 } // namespace content 762 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698