OLD | NEW |
---|---|
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" |
11 #include "content/browser/browsing_data/clear_site_data_throttle.h" | 11 #include "content/browser/browsing_data/clear_site_data_throttle.h" |
12 #include "content/browser/child_process_security_policy_impl.h" | 12 #include "content/browser/child_process_security_policy_impl.h" |
13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 13 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
14 #include "content/browser/frame_host/frame_tree_node.h" | 14 #include "content/browser/frame_host/frame_tree_node.h" |
15 #include "content/browser/frame_host/navigator.h" | 15 #include "content/browser/frame_host/navigator.h" |
16 #include "content/browser/frame_host/navigator_delegate.h" | 16 #include "content/browser/frame_host/navigator_delegate.h" |
17 #include "content/browser/frame_host/render_frame_host_manager.h" | |
17 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 18 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
18 #include "content/browser/service_worker/service_worker_navigation_handle.h" | 19 #include "content/browser/service_worker/service_worker_navigation_handle.h" |
19 #include "content/common/frame_messages.h" | 20 #include "content/common/frame_messages.h" |
20 #include "content/common/resource_request_body_impl.h" | 21 #include "content/common/resource_request_body_impl.h" |
21 #include "content/common/site_isolation_policy.h" | 22 #include "content/common/site_isolation_policy.h" |
22 #include "content/public/browser/content_browser_client.h" | 23 #include "content/public/browser/content_browser_client.h" |
23 #include "content/public/browser/navigation_ui_data.h" | 24 #include "content/public/browser/navigation_ui_data.h" |
24 #include "content/public/browser/site_instance.h" | 25 #include "content/public/browser/site_instance.h" |
25 #include "content/public/common/browser_side_navigation_policy.h" | 26 #include "content/public/common/browser_side_navigation_policy.h" |
26 #include "content/public/common/content_client.h" | 27 #include "content/public/common/content_client.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
84 navigation_start_(navigation_start), | 85 navigation_start_(navigation_start), |
85 pending_nav_entry_id_(pending_nav_entry_id), | 86 pending_nav_entry_id_(pending_nav_entry_id), |
86 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), | 87 request_context_type_(REQUEST_CONTEXT_TYPE_UNSPECIFIED), |
87 should_replace_current_entry_(false), | 88 should_replace_current_entry_(false), |
88 is_download_(false), | 89 is_download_(false), |
89 is_stream_(false), | 90 is_stream_(false), |
90 started_from_context_menu_(started_from_context_menu), | 91 started_from_context_menu_(started_from_context_menu), |
91 weak_factory_(this) { | 92 weak_factory_(this) { |
92 DCHECK(!navigation_start.is_null()); | 93 DCHECK(!navigation_start.is_null()); |
93 redirect_chain_.push_back(url); | 94 redirect_chain_.push_back(url); |
95 | |
96 RenderFrameHostImpl* creator_frame = | |
97 frame_tree_node_->render_manager()->current_frame_host(); | |
alexmos
2016/10/12 23:13:28
nit: This can be shortened to frame_tree_node_->cu
jam
2016/10/13 00:14:46
Done.
| |
98 // TODO(jam): do we need to handle the case where there's no initial frame | |
99 // host? Revisit as more code uses this site instance which would expose | |
100 // missing cases. | |
101 if (creator_frame) | |
102 creator_site_instance_ = creator_frame->GetSiteInstance(); | |
103 | |
94 GetDelegate()->DidStartNavigation(this); | 104 GetDelegate()->DidStartNavigation(this); |
95 | 105 |
96 if (IsInMainFrame()) { | 106 if (IsInMainFrame()) { |
97 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( | 107 TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( |
98 "navigation", "Navigation StartToCommit", this, | 108 "navigation", "Navigation StartToCommit", this, |
99 navigation_start, "Initial URL", url_.spec()); | 109 navigation_start, "Initial URL", url_.spec()); |
100 } | 110 } |
101 } | 111 } |
102 | 112 |
103 NavigationHandleImpl::~NavigationHandleImpl() { | 113 NavigationHandleImpl::~NavigationHandleImpl() { |
(...skipping 17 matching lines...) Expand all Loading... | |
121 | 131 |
122 RequestContextType NavigationHandleImpl::GetRequestContextType() const { | 132 RequestContextType NavigationHandleImpl::GetRequestContextType() const { |
123 DCHECK_GE(state_, WILL_SEND_REQUEST); | 133 DCHECK_GE(state_, WILL_SEND_REQUEST); |
124 return request_context_type_; | 134 return request_context_type_; |
125 } | 135 } |
126 | 136 |
127 const GURL& NavigationHandleImpl::GetURL() { | 137 const GURL& NavigationHandleImpl::GetURL() { |
128 return url_; | 138 return url_; |
129 } | 139 } |
130 | 140 |
141 SiteInstance* NavigationHandleImpl::GetCreatorSiteInstance() { | |
142 return creator_site_instance_.get(); | |
143 } | |
144 | |
131 bool NavigationHandleImpl::IsInMainFrame() { | 145 bool NavigationHandleImpl::IsInMainFrame() { |
132 return frame_tree_node_->IsMainFrame(); | 146 return frame_tree_node_->IsMainFrame(); |
133 } | 147 } |
134 | 148 |
135 bool NavigationHandleImpl::IsParentMainFrame() { | 149 bool NavigationHandleImpl::IsParentMainFrame() { |
136 if (frame_tree_node_->parent()) | 150 if (frame_tree_node_->parent()) |
137 return frame_tree_node_->parent()->IsMainFrame(); | 151 return frame_tree_node_->parent()->IsMainFrame(); |
138 | 152 |
139 return false; | 153 return false; |
140 } | 154 } |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 throttles_to_register.end()); | 759 throttles_to_register.end()); |
746 throttles_to_register.weak_clear(); | 760 throttles_to_register.weak_clear(); |
747 } | 761 } |
748 } | 762 } |
749 | 763 |
750 bool NavigationHandleImpl::WasStartedFromContextMenu() const { | 764 bool NavigationHandleImpl::WasStartedFromContextMenu() const { |
751 return started_from_context_menu_; | 765 return started_from_context_menu_; |
752 } | 766 } |
753 | 767 |
754 } // namespace content | 768 } // namespace content |
OLD | NEW |