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

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

Issue 2534393003: (Reland) 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 NavigationGesture gesture) { 145 NavigationGesture gesture) {
148 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); 146 bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame();
149 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 147 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
150 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
151 GURL validated_url(url); 148 GURL validated_url(url);
152 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); 149 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
153 render_process_host->FilterURL(false, &validated_url); 150 render_process_host->FilterURL(false, &validated_url);
154 151
155 // Do not allow browser plugin guests to navigate to non-web URLs, since they 152 // Do not allow browser plugin guests to navigate to non-web URLs, since they
156 // cannot swap processes or grant bindings. 153 // cannot swap processes or grant bindings.
157 ChildProcessSecurityPolicyImpl* policy = 154 ChildProcessSecurityPolicyImpl* policy =
158 ChildProcessSecurityPolicyImpl::GetInstance(); 155 ChildProcessSecurityPolicyImpl::GetInstance();
159 if (render_process_host->IsForGuestsOnly() && 156 if (render_process_host->IsForGuestsOnly() &&
160 !policy->IsWebSafeScheme(validated_url.scheme())) { 157 !policy->IsWebSafeScheme(validated_url.scheme())) {
161 validated_url = GURL(url::kAboutBlankURL); 158 validated_url = GURL(url::kAboutBlankURL);
162 } 159 }
163 160
164 if (is_main_frame && !is_error_page) { 161 if (is_main_frame && !is_error_page) {
165 DidStartMainFrameNavigation(validated_url, 162 DidStartMainFrameNavigation(validated_url,
166 render_frame_host->GetSiteInstance(), 163 render_frame_host->GetSiteInstance(),
167 render_frame_host->navigation_handle()); 164 render_frame_host->navigation_handle());
168 } 165 }
169 166
170 if (delegate_) { 167 if (delegate_) {
171 // Notify the observer about the start of the provisional load. 168 // Notify the observer about the start of the provisional load.
172 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, 169 delegate_->DidStartProvisionalLoad(render_frame_host, validated_url,
173 is_error_page, is_iframe_srcdoc); 170 is_error_page);
174 } 171 }
175 172
176 if (is_error_page || IsBrowserSideNavigationEnabled()) 173 if (is_error_page || IsBrowserSideNavigationEnabled())
177 return; 174 return;
178 175
179 if (render_frame_host->navigation_handle()) { 176 if (render_frame_host->navigation_handle()) {
180 if (render_frame_host->navigation_handle()->is_transferring()) { 177 if (render_frame_host->navigation_handle()->is_transferring()) {
181 // If the navigation is completing a transfer, this 178 // If the navigation is completing a transfer, this
182 // DidStartProvisionalLoad should not correspond to a new navigation. 179 // DidStartProvisionalLoad should not correspond to a new navigation.
183 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); 180 DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL());
(...skipping 17 matching lines...) Expand all
201 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); 198 NavigationEntryImpl* pending_entry = controller_->GetPendingEntry();
202 if (pending_entry) { 199 if (pending_entry) {
203 is_renderer_initiated = pending_entry->is_renderer_initiated(); 200 is_renderer_initiated = pending_entry->is_renderer_initiated();
204 pending_nav_entry_id = pending_entry->GetUniqueID(); 201 pending_nav_entry_id = pending_entry->GetUniqueID();
205 started_from_context_menu = pending_entry->has_started_from_context_menu(); 202 started_from_context_menu = pending_entry->has_started_from_context_menu();
206 } 203 }
207 204
208 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( 205 render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create(
209 validated_url, render_frame_host->frame_tree_node(), 206 validated_url, render_frame_host->frame_tree_node(),
210 is_renderer_initiated, 207 is_renderer_initiated,
211 false, // is_same_page 208 false, // is_same_page
212 is_iframe_srcdoc, // is_srcdoc
213 navigation_start, pending_nav_entry_id, gesture, 209 navigation_start, pending_nav_entry_id, gesture,
214 started_from_context_menu)); 210 started_from_context_menu));
215 } 211 }
216 212
217 void NavigatorImpl::DidFailProvisionalLoadWithError( 213 void NavigatorImpl::DidFailProvisionalLoadWithError(
218 RenderFrameHostImpl* render_frame_host, 214 RenderFrameHostImpl* render_frame_host,
219 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { 215 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {
220 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec() 216 VLOG(1) << "Failed Provisional Load: " << params.url.possibly_invalid_spec()
221 << ", error_code: " << params.error_code 217 << ", error_code: " << params.error_code
222 << ", error_description: " << params.error_description 218 << ", error_description: " << params.error_description
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 if (navigation_handle) 1267 if (navigation_handle)
1272 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); 1268 navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID());
1273 1269
1274 controller_->SetPendingEntry(std::move(entry)); 1270 controller_->SetPendingEntry(std::move(entry));
1275 if (delegate_) 1271 if (delegate_)
1276 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); 1272 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
1277 } 1273 }
1278 } 1274 }
1279 1275
1280 } // namespace content 1276 } // 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