OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/navigator_impl.h" | 5 #include "content/browser/frame_host/navigator_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 #include "content/public/browser/navigation_details.h" | 38 #include "content/public/browser/navigation_details.h" |
39 #include "content/public/browser/page_navigator.h" | 39 #include "content/public/browser/page_navigator.h" |
40 #include "content/public/browser/render_view_host.h" | 40 #include "content/public/browser/render_view_host.h" |
41 #include "content/public/browser/stream_handle.h" | 41 #include "content/public/browser/stream_handle.h" |
42 #include "content/public/browser/user_metrics.h" | 42 #include "content/public/browser/user_metrics.h" |
43 #include "content/public/common/bindings_policy.h" | 43 #include "content/public/common/bindings_policy.h" |
44 #include "content/public/common/browser_side_navigation_policy.h" | 44 #include "content/public/common/browser_side_navigation_policy.h" |
45 #include "content/public/common/content_client.h" | 45 #include "content/public/common/content_client.h" |
46 #include "content/public/common/content_constants.h" | 46 #include "content/public/common/content_constants.h" |
47 #include "content/public/common/resource_response.h" | 47 #include "content/public/common/resource_response.h" |
| 48 #include "content/public/common/url_constants.h" |
48 #include "net/base/net_errors.h" | 49 #include "net/base/net_errors.h" |
49 #include "url/gurl.h" | 50 #include "url/gurl.h" |
| 51 #include "url/url_constants.h" |
50 | 52 |
51 namespace content { | 53 namespace content { |
52 | 54 |
53 namespace { | 55 namespace { |
54 | 56 |
55 FrameMsg_Navigate_Type::Value GetNavigationType( | 57 FrameMsg_Navigate_Type::Value GetNavigationType( |
56 BrowserContext* browser_context, | 58 BrowserContext* browser_context, |
57 const NavigationEntryImpl& entry, | 59 const NavigationEntryImpl& entry, |
58 ReloadType reload_type) { | 60 ReloadType reload_type) { |
59 switch (reload_type) { | 61 switch (reload_type) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 NavigationController* NavigatorImpl::GetController() { | 139 NavigationController* NavigatorImpl::GetController() { |
138 return controller_; | 140 return controller_; |
139 } | 141 } |
140 | 142 |
141 void NavigatorImpl::DidStartProvisionalLoad( | 143 void NavigatorImpl::DidStartProvisionalLoad( |
142 RenderFrameHostImpl* render_frame_host, | 144 RenderFrameHostImpl* render_frame_host, |
143 const GURL& url, | 145 const GURL& url, |
144 const base::TimeTicks& navigation_start) { | 146 const base::TimeTicks& navigation_start) { |
145 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); | 147 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); |
146 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | 148 bool is_error_page = (url.spec() == kUnreachableWebDataURL); |
| 149 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); |
147 GURL validated_url(url); | 150 GURL validated_url(url); |
148 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); | 151 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); |
149 render_process_host->FilterURL(false, &validated_url); | 152 render_process_host->FilterURL(false, &validated_url); |
150 | 153 |
151 // Do not allow browser plugin guests to navigate to non-web URLs, since they | 154 // Do not allow browser plugin guests to navigate to non-web URLs, since they |
152 // cannot swap processes or grant bindings. | 155 // cannot swap processes or grant bindings. |
153 ChildProcessSecurityPolicyImpl* policy = | 156 ChildProcessSecurityPolicyImpl* policy = |
154 ChildProcessSecurityPolicyImpl::GetInstance(); | 157 ChildProcessSecurityPolicyImpl::GetInstance(); |
155 if (render_process_host->IsForGuestsOnly() && | 158 if (render_process_host->IsForGuestsOnly() && |
156 !policy->IsWebSafeScheme(validated_url.scheme())) { | 159 !policy->IsWebSafeScheme(validated_url.scheme())) { |
157 validated_url = GURL(url::kAboutBlankURL); | 160 validated_url = GURL(url::kAboutBlankURL); |
158 } | 161 } |
159 | 162 |
160 if (is_main_frame && !is_error_page) { | 163 if (is_main_frame && !is_error_page) { |
161 DidStartMainFrameNavigation(validated_url, | 164 DidStartMainFrameNavigation(validated_url, |
162 render_frame_host->GetSiteInstance(), | 165 render_frame_host->GetSiteInstance(), |
163 render_frame_host->navigation_handle()); | 166 render_frame_host->navigation_handle()); |
164 } | 167 } |
165 | 168 |
166 if (delegate_) { | 169 if (delegate_) { |
167 // Notify the observer about the start of the provisional load. | 170 // Notify the observer about the start of the provisional load. |
168 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, | 171 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, |
169 is_error_page); | 172 is_error_page, is_iframe_srcdoc); |
170 } | 173 } |
171 | 174 |
172 if (is_error_page || IsBrowserSideNavigationEnabled()) | 175 if (is_error_page || IsBrowserSideNavigationEnabled()) |
173 return; | 176 return; |
174 | 177 |
175 if (render_frame_host->navigation_handle()) { | 178 if (render_frame_host->navigation_handle()) { |
176 if (render_frame_host->navigation_handle()->is_transferring()) { | 179 if (render_frame_host->navigation_handle()->is_transferring()) { |
177 // If the navigation is completing a transfer, this | 180 // If the navigation is completing a transfer, this |
178 // DidStartProvisionalLoad should not correspond to a new navigation. | 181 // DidStartProvisionalLoad should not correspond to a new navigation. |
179 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); | 182 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); |
(...skipping 18 matching lines...) Expand all Loading... |
198 if (pending_entry) { | 201 if (pending_entry) { |
199 is_renderer_initiated = pending_entry->is_renderer_initiated(); | 202 is_renderer_initiated = pending_entry->is_renderer_initiated(); |
200 pending_nav_entry_id = pending_entry->GetUniqueID(); | 203 pending_nav_entry_id = pending_entry->GetUniqueID(); |
201 started_from_context_menu = pending_entry->has_started_from_context_menu(); | 204 started_from_context_menu = pending_entry->has_started_from_context_menu(); |
202 } | 205 } |
203 | 206 |
204 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( | 207 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( |
205 validated_url, render_frame_host->frame_tree_node(), | 208 validated_url, render_frame_host->frame_tree_node(), |
206 is_renderer_initiated, | 209 is_renderer_initiated, |
207 false, // is_same_page | 210 false, // is_same_page |
| 211 is_iframe_srcdoc, // is_srcdoc |
208 navigation_start, pending_nav_entry_id, started_from_context_menu)); | 212 navigation_start, pending_nav_entry_id, started_from_context_menu)); |
209 } | 213 } |
210 | 214 |
211 void NavigatorImpl::DidFailProvisionalLoadWithError( | 215 void NavigatorImpl::DidFailProvisionalLoadWithError( |
212 RenderFrameHostImpl* render_frame_host, | 216 RenderFrameHostImpl* render_frame_host, |
213 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 217 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
214 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() | 218 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() |
215 << ", error_code: " << params.error_code | 219 << ", error_code: " << params.error_code |
216 << ", error_description: " << params.error_description | 220 << ", error_description: " << params.error_description |
217 << ", showing_repost_interstitial: " << | 221 << ", showing_repost_interstitial: " << |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 if (navigation_handle) | 1268 if (navigation_handle) |
1265 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); | 1269 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); |
1266 | 1270 |
1267 controller_->SetPendingEntry(std::move(entry)); | 1271 controller_->SetPendingEntry(std::move(entry)); |
1268 if (delegate_) | 1272 if (delegate_) |
1269 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); | 1273 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); |
1270 } | 1274 } |
1271 } | 1275 } |
1272 | 1276 |
1273 } // namespace content | 1277 } // namespace content |
OLD | NEW |