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

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

Issue 118443008: Support cross-process navigations in a single subframe RenderFrameHost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Minor cleanup Created 7 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 | 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/navigator_impl.h" 5 #include "content/browser/frame_host/navigator_impl.h"
6 6
7 #include "base/command_line.h"
7 #include "content/browser/frame_host/frame_tree_node.h" 8 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/frame_host/navigation_controller_impl.h" 9 #include "content/browser/frame_host/navigation_controller_impl.h"
9 #include "content/browser/frame_host/navigation_entry_impl.h" 10 #include "content/browser/frame_host/navigation_entry_impl.h"
10 #include "content/browser/frame_host/navigator_delegate.h" 11 #include "content/browser/frame_host/navigator_delegate.h"
11 #include "content/browser/frame_host/render_frame_host_impl.h" 12 #include "content/browser/frame_host/render_frame_host_impl.h"
12 #include "content/browser/renderer_host/render_view_host_impl.h" 13 #include "content/browser/renderer_host/render_view_host_impl.h"
13 #include "content/browser/site_instance_impl.h" 14 #include "content/browser/site_instance_impl.h"
14 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/invalidate_type.h" 16 #include "content/public/browser/invalidate_type.h"
16 #include "content/public/browser/navigation_controller.h" 17 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
19 #include "content/public/common/content_switches.h"
18 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
19 21
20 namespace content { 22 namespace content {
21 23
22 NavigatorImpl::NavigatorImpl( 24 NavigatorImpl::NavigatorImpl(
23 NavigationControllerImpl* navigation_controller, 25 NavigationControllerImpl* navigation_controller,
24 NavigatorDelegate* delegate) 26 NavigatorDelegate* delegate)
25 : controller_(navigation_controller), 27 : controller_(navigation_controller),
26 delegate_(delegate) { 28 delegate_(delegate) {
27 } 29 }
28 30
29 void NavigatorImpl::DidStartProvisionalLoad( 31 void NavigatorImpl::DidStartProvisionalLoad(
30 RenderFrameHostImpl* render_frame_host, 32 RenderFrameHostImpl* render_frame_host,
31 int64 frame_id, 33 int64 frame_id,
32 int64 parent_frame_id, 34 int64 parent_frame_id,
33 bool is_main_frame, 35 bool is_main_frame,
34 const GURL& url) { 36 const GURL& url) {
35 bool is_error_page = (url.spec() == kUnreachableWebDataURL); 37 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
36 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); 38 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
37 GURL validated_url(url); 39 GURL validated_url(url);
38 RenderProcessHost* render_process_host = render_frame_host->GetProcess(); 40 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
39 RenderViewHost::FilterURL(render_process_host, false, &validated_url); 41 RenderViewHost::FilterURL(render_process_host, false, &validated_url);
40 42
43 // TODO(creis): This is a hack for now, until we mirror the frame tree and do
44 // cross-process subframe navigations in actual subframes. As a result, we
45 // can currently only support a single cross-process subframe per RVH.
46 NavigationEntryImpl* pending_entry =
47 NavigationEntryImpl::FromNavigationEntry(controller_->GetPendingEntry());
48 if (pending_entry &&
49 pending_entry->frame_tree_node_id() != -1 &&
50 CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess))
51 is_main_frame = false;
52
41 if (is_main_frame) { 53 if (is_main_frame) {
42 // If there is no browser-initiated pending entry for this navigation and it 54 // If there is no browser-initiated pending entry for this navigation and it
43 // is not for the error URL, create a pending entry using the current 55 // is not for the error URL, create a pending entry using the current
44 // SiteInstance, and ensure the address bar updates accordingly. We don't 56 // SiteInstance, and ensure the address bar updates accordingly. We don't
45 // know the referrer or extra headers at this point, but the referrer will 57 // know the referrer or extra headers at this point, but the referrer will
46 // be set properly upon commit. 58 // be set properly upon commit.
47 NavigationEntryImpl* pending_entry =
48 NavigationEntryImpl::FromNavigationEntry(
49 controller_->GetPendingEntry());
50 bool has_browser_initiated_pending_entry = pending_entry && 59 bool has_browser_initiated_pending_entry = pending_entry &&
51 !pending_entry->is_renderer_initiated(); 60 !pending_entry->is_renderer_initiated();
52 if (!has_browser_initiated_pending_entry && !is_error_page) { 61 if (!has_browser_initiated_pending_entry && !is_error_page) {
53 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( 62 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
54 controller_->CreateNavigationEntry(validated_url, 63 controller_->CreateNavigationEntry(validated_url,
55 content::Referrer(), 64 content::Referrer(),
56 content::PAGE_TRANSITION_LINK, 65 content::PAGE_TRANSITION_LINK,
57 true /* is_renderer_initiated */, 66 true /* is_renderer_initiated */,
58 std::string(), 67 std::string(),
59 controller_->GetBrowserContext())); 68 controller_->GetBrowserContext()));
(...skipping 16 matching lines...) Expand all
76 85
77 if (delegate_) { 86 if (delegate_) {
78 // Notify the observer about the start of the provisional load. 87 // Notify the observer about the start of the provisional load.
79 delegate_->DidStartProvisionalLoad( 88 delegate_->DidStartProvisionalLoad(
80 render_frame_host, frame_id, parent_frame_id, is_main_frame, 89 render_frame_host, frame_id, parent_frame_id, is_main_frame,
81 validated_url, is_error_page, is_iframe_srcdoc); 90 validated_url, is_error_page, is_iframe_srcdoc);
82 } 91 }
83 } 92 }
84 93
85 } // namespace content 94 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698