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

Side by Side Diff: trunk/src/content/browser/frame_host/render_frame_host_impl.cc

Issue 181113009: Revert 253010 "Revert 251563 "Move browser initiated navigation ..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/containers/hash_tables.h" 7 #include "base/containers/hash_tables.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/metrics/user_metrics_action.h" 9 #include "base/metrics/user_metrics_action.h"
10 #include "content/browser/child_process_security_policy_impl.h"
10 #include "content/browser/frame_host/cross_process_frame_connector.h" 11 #include "content/browser/frame_host/cross_process_frame_connector.h"
11 #include "content/browser/frame_host/frame_tree.h" 12 #include "content/browser/frame_host/frame_tree.h"
12 #include "content/browser/frame_host/frame_tree_node.h" 13 #include "content/browser/frame_host/frame_tree_node.h"
13 #include "content/browser/frame_host/navigator.h" 14 #include "content/browser/frame_host/navigator.h"
14 #include "content/browser/frame_host/render_frame_host_delegate.h" 15 #include "content/browser/frame_host/render_frame_host_delegate.h"
15 #include "content/browser/renderer_host/render_view_host_impl.h" 16 #include "content/browser/renderer_host/render_view_host_impl.h"
16 #include "content/common/frame_messages.h" 17 #include "content/common/frame_messages.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/content_browser_client.h" 19 #include "content/public/browser/content_browser_client.h"
19 #include "content/public/browser/render_process_host.h" 20 #include "content/public/browser/render_process_host.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 357
357 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { 358 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) {
358 // TODO(creis): We should also check for WebUI pages here. Also, when the 359 // TODO(creis): We should also check for WebUI pages here. Also, when the
359 // out-of-process iframes implementation is ready, we should check for 360 // out-of-process iframes implementation is ready, we should check for
360 // cross-site URLs that are not allowed to commit in this process. 361 // cross-site URLs that are not allowed to commit in this process.
361 362
362 // Give the client a chance to disallow URLs from committing. 363 // Give the client a chance to disallow URLs from committing.
363 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); 364 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url);
364 } 365 }
365 366
367 void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) {
368 TRACE_EVENT0("frame_host", "RenderFrameHostImpl::Navigate");
369 // Browser plugin guests are not allowed to navigate outside web-safe schemes,
370 // so do not grant them the ability to request additional URLs.
371 if (!GetProcess()->IsGuest()) {
372 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
373 GetProcess()->GetID(), params.url);
374 if (params.url.SchemeIs(kDataScheme) &&
375 params.base_url_for_data_url.SchemeIs(kFileScheme)) {
376 // If 'data:' is used, and we have a 'file:' base url, grant access to
377 // local files.
378 ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL(
379 GetProcess()->GetID(), params.base_url_for_data_url);
380 }
381 }
382
383 // Only send the message if we aren't suspended at the start of a cross-site
384 // request.
385 if (render_view_host_->navigations_suspended_) {
386 // Shouldn't be possible to have a second navigation while suspended, since
387 // navigations will only be suspended during a cross-site request. If a
388 // second navigation occurs, RenderFrameHostManager will cancel this pending
389 // RFH and create a new pending RFH.
390 DCHECK(!render_view_host_->suspended_nav_params_.get());
391 render_view_host_->suspended_nav_params_.reset(
392 new FrameMsg_Navigate_Params(params));
393 } else {
394 // Get back to a clean state, in case we start a new navigation without
395 // completing a RVH swap or unload handler.
396 render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT);
397
398 Send(new FrameMsg_Navigate(GetRoutingID(), params));
399 }
400
401 // Force the throbber to start. We do this because Blink's "started
402 // loading" message will be received asynchronously from the UI of the
403 // browser. But we want to keep the throbber in sync with what's happening
404 // in the UI. For example, we want to start throbbing immediately when the
405 // user naivgates even if the renderer is delayed. There is also an issue
406 // with the throbber starting because the WebUI (which controls whether the
407 // favicon is displayed) happens synchronously. If the start loading
408 // messages was asynchronous, then the default favicon would flash in.
409 //
410 // Blink doesn't send throb notifications for JavaScript URLs, so we
411 // don't want to either.
412 if (!params.url.SchemeIs(kJavaScriptScheme))
413 delegate_->DidStartLoading(this);
414 }
415
416 void RenderFrameHostImpl::NavigateToURL(const GURL& url) {
417 FrameMsg_Navigate_Params params;
418 params.page_id = -1;
419 params.pending_history_list_offset = -1;
420 params.current_history_list_offset = -1;
421 params.current_history_list_length = 0;
422 params.url = url;
423 params.transition = PAGE_TRANSITION_LINK;
424 params.navigation_type = FrameMsg_Navigate_Type::NORMAL;
425 Navigate(params);
426 }
427
366 } // namespace content 428 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698