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

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

Issue 26316005: Move out DidStartProvisionalLoad from WebContentsImpl into Navigator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on Charlie's latest review. 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 "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_entry_impl.h"
7 #include "content/browser/frame_host/navigator_delegate.h" 10 #include "content/browser/frame_host/navigator_delegate.h"
11 #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/site_instance_impl.h"
14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/invalidate_type.h"
16 #include "content/public/browser/navigation_controller.h"
17 #include "content/public/browser/render_view_host.h"
18 #include "content/public/common/url_constants.h"
8 19
9 namespace content { 20 namespace content {
10 21
11 NavigatorImpl::NavigatorImpl( 22 NavigatorImpl::NavigatorImpl(
12 NavigationControllerImpl* navigation_controller, 23 NavigationControllerImpl* navigation_controller,
13 NavigatorDelegate* delegate) { 24 NavigatorDelegate* delegate)
25 : controller_(navigation_controller),
26 delegate_(delegate) {
27 }
28
29 void NavigatorImpl::DidStartProvisionalLoad(
30 RenderFrameHostImpl* render_frame_host,
31 int64 frame_id,
32 int64 parent_frame_id,
33 bool is_main_frame,
34 const GURL& url) {
35 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
36 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
37 GURL validated_url(url);
38 RenderProcessHost* render_process_host = render_frame_host->GetProcess();
39 RenderViewHost::FilterURL(render_process_host, false, &validated_url);
40
41 if (is_main_frame) {
42 // 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
44 // 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
46 // be set properly upon commit.
47 NavigationEntryImpl* pending_entry =
48 NavigationEntryImpl::FromNavigationEntry(
49 controller_->GetPendingEntry());
50 bool has_browser_initiated_pending_entry = pending_entry &&
51 !pending_entry->is_renderer_initiated();
52 if (!has_browser_initiated_pending_entry && !is_error_page) {
53 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
54 controller_->CreateNavigationEntry(validated_url,
55 content::Referrer(),
56 content::PAGE_TRANSITION_LINK,
57 true /* is_renderer_initiated */,
58 std::string(),
59 controller_->GetBrowserContext()));
60 entry->set_site_instance(
61 static_cast<SiteInstanceImpl*>(
62 render_frame_host->render_view_host()->GetSiteInstance()));
63 // TODO(creis): If there's a pending entry already, find a safe way to
64 // update it instead of replacing it and copying over things like this.
65 if (pending_entry) {
66 entry->set_transferred_global_request_id(
67 pending_entry->transferred_global_request_id());
68 entry->set_should_replace_entry(pending_entry->should_replace_entry());
69 entry->set_redirect_chain(pending_entry->redirect_chain());
70 }
71 controller_->SetPendingEntry(entry);
72 if (delegate_)
73 delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL);
74 }
75 }
76
77 if (delegate_) {
78 // Notify the observer about the start of the provisional load.
79 delegate_->DidStartProvisionalLoad(
80 render_frame_host, frame_id, parent_frame_id, is_main_frame,
81 validated_url, is_error_page, is_iframe_srcdoc);
82 }
14 } 83 }
15 84
16 } // namespace content 85 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/navigator_impl.h ('k') | content/browser/frame_host/render_frame_host_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698