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

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

Issue 2494633004: Remove about:srcdoc url conversion. (Closed)
Patch Set: Rebase Created 4 years 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 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
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"
49 #include "net/base/net_errors.h" 48 #include "net/base/net_errors.h"
50 #include "url/gurl.h" 49 #include "url/gurl.h"
51 #include "url/url_constants.h"
52 50
53 namespace content { 51 namespace content {
54 52
55 namespace { 53 namespace {
56 54
57 FrameMsg_Navigate_Type::Value GetNavigationType( 55 FrameMsg_Navigate_Type::Value GetNavigationType(
58 BrowserContext* browser_context, 56 BrowserContext* browser_context,
59 const NavigationEntryImpl& entry, 57 const NavigationEntryImpl& entry,
60 ReloadType reload_type) { 58 ReloadType reload_type) {
61 switch (reload_type) { 59 switch (reload_type) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 NavigationController* NavigatorImpl::GetController() { 137 NavigationController* NavigatorImpl::GetController() {
140 return controller_; 138 return controller_;
141 } 139 }
142 140
143 void NavigatorImpl::DidStartProvisionalLoad( 141 void NavigatorImpl::DidStartProvisionalLoad(
144 RenderFrameHostImpl* render_frame_host, 142 RenderFrameHostImpl* render_frame_host,
145 const GURL& url, 143 const GURL& url,
146 const base::TimeTicks& navigation_start) { 144 const base::TimeTicks& navigation_start) {
147 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); 145 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame();
148 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 146 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
149 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
150 GURL validated_url(url); 147 GURL validated_url(url);
151 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); 148 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
152 render_process_host->FilterURL(false, &validated_url); 149 render_process_host->FilterURL(false, &validated_url);
153 150
154 // Do not allow browser plugin guests to navigate to non-web URLs, since they 151 // Do not allow browser plugin guests to navigate to non-web URLs, since they
155 // cannot swap processes or grant bindings. 152 // cannot swap processes or grant bindings.
156 ChildProcessSecurityPolicyImpl* policy = 153 ChildProcessSecurityPolicyImpl* policy =
157 ChildProcessSecurityPolicyImpl::GetInstance(); 154 ChildProcessSecurityPolicyImpl::GetInstance();
158 if (render_process_host->IsForGuestsOnly() && 155 if (render_process_host->IsForGuestsOnly() &&
159 !policy->IsWebSafeScheme(validated_url.scheme())) { 156 !policy->IsWebSafeScheme(validated_url.scheme())) {
160 validated_url = GURL(url::kAboutBlankURL); 157 validated_url = GURL(url::kAboutBlankURL);
161 } 158 }
162 159
163 if (is_main_frame && !is_error_page) { 160 if (is_main_frame && !is_error_page) {
164 DidStartMainFrameNavigation(validated_url, 161 DidStartMainFrameNavigation(validated_url,
165 render_frame_host->GetSiteInstance(), 162 render_frame_host->GetSiteInstance(),
166 render_frame_host->navigation_handle()); 163 render_frame_host->navigation_handle());
167 } 164 }
168 165
169 if (delegate_) { 166 if (delegate_) {
170 // Notify the observer about the start of the provisional load. 167 // Notify the observer about the start of the provisional load.
171 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, 168 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url,
172 is_error_page, is_iframe_srcdoc); 169 is_error_page);
173 } 170 }
174 171
175 if (is_error_page || IsBrowserSideNavigationEnabled()) 172 if (is_error_page || IsBrowserSideNavigationEnabled())
176 return; 173 return;
177 174
178 if (render_frame_host->navigation_handle()) { 175 if (render_frame_host->navigation_handle()) {
179 if (render_frame_host->navigation_handle()->is_transferring()) { 176 if (render_frame_host->navigation_handle()->is_transferring()) {
180 // If the navigation is completing a transfer, this 177 // If the navigation is completing a transfer, this
181 // DidStartProvisionalLoad should not correspond to a new navigation. 178 // DidStartProvisionalLoad should not correspond to a new navigation.
182 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); 179 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL());
(...skipping 18 matching lines...) Expand all
201 if (pending_entry) { 198 if (pending_entry) {
202 is_renderer_initiated = pending_entry->is_renderer_initiated(); 199 is_renderer_initiated = pending_entry->is_renderer_initiated();
203 pending_nav_entry_id = pending_entry->GetUniqueID(); 200 pending_nav_entry_id = pending_entry->GetUniqueID();
204 started_from_context_menu = pending_entry->has_started_from_context_menu(); 201 started_from_context_menu = pending_entry->has_started_from_context_menu();
205 } 202 }
206 203
207 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( 204 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
208 validated_url, render_frame_host->frame_tree_node(), 205 validated_url, render_frame_host->frame_tree_node(),
209 is_renderer_initiated, 206 is_renderer_initiated,
210 false, // is_same_page 207 false, // is_same_page
211 is_iframe_srcdoc, // is_srcdoc
212 navigation_start, pending_nav_entry_id, started_from_context_menu)); 208 navigation_start, pending_nav_entry_id, started_from_context_menu));
213 } 209 }
214 210
215 void NavigatorImpl::DidFailProvisionalLoadWithError( 211 void NavigatorImpl::DidFailProvisionalLoadWithError(
216 RenderFrameHostImpl* render_frame_host, 212 RenderFrameHostImpl* render_frame_host,
217 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 213 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
218 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() 214 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
219 << ", error_code: " << params.error_code 215 << ", error_code: " << params.error_code
220 << ", error_description: " << params.error_description 216 << ", error_description: " << params.error_description
221 << ", showing_repost_interstitial: " << 217 << ", showing_repost_interstitial: " <<
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after
1268 if (navigation_handle) 1264 if (navigation_handle)
1269 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1265 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1270 1266
1271 controller_->SetPendingEntry(std::move(entry)); 1267 controller_->SetPendingEntry(std::move(entry));
1272 if (delegate_) 1268 if (delegate_)
1273 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1269 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1274 } 1270 }
1275 } 1271 }
1276 1272
1277 } // namespace content 1273 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_delegate.h ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698