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

Side by Side Diff: content/browser/renderer_host/navigator.cc

Issue 26316005: Move out DidStartProvisionalLoad from WebContentsImpl into Navigator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Initial upload Created 7 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/navigator.h"
6
7 #include "content/browser/renderer_host/navigator_observer.h"
8 #include "content/browser/renderer_host/render_frame_host_impl.h"
9 #include "content/browser/site_instance_impl.h"
10 #include "content/browser/web_contents/navigation_controller_impl.h"
11 #include "content/browser/web_contents/navigation_entry_impl.h"
12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/invalidate_type.h"
14 #include "content/public/browser/navigation_controller.h"
15 #include "content/public/browser/render_view_host.h"
16 #include "content/public/common/url_constants.h"
17
18 namespace content {
19
20 void Navigator::DidStartProvisionalLoad(
21 RenderFrameHost* render_frame_host,
22 int64 frame_id,
23 int64 parent_frame_id,
24 bool is_main_frame,
25 const GURL& url) {
26 bool is_error_page = (url.spec() == kUnreachableWebDataURL);
27 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
28 GURL validated_url(url);
29 RenderProcessHost* render_process_host =
30 render_frame_host->GetProcess();
31 RenderViewHost::FilterURL(render_process_host, false, &validated_url);
32
33 if (is_main_frame) {
34 // If there is no browser-initiated pending entry for this navigation and it
35 // is not for the error URL, create a pending entry using the current
36 // SiteInstance, and ensure the address bar updates accordingly. We don't
37 // know the referrer or extra headers at this point, but the referrer will
38 // be set properly upon commit.
39 NavigationEntry* pending_entry = controller_->GetPendingEntry();
40 bool has_browser_initiated_pending_entry = pending_entry &&
41 !NavigationEntryImpl::FromNavigationEntry(pending_entry)->
42 is_renderer_initiated();
43 if (!has_browser_initiated_pending_entry && !is_error_page) {
44 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
45 controller_->CreateNavigationEntry(validated_url,
46 content::Referrer(),
47 content::PAGE_TRANSITION_LINK,
48 true /* is_renderer_initiated */,
49 std::string(),
50 controller_->GetBrowserContext()));
51 render_frame_host->GetSiteInstance();
52 controller_->SetPendingEntry(entry);
53 observer_->NavigationStateChanged(content::INVALIDATE_TYPE_URL);
54 }
55 }
56
57 // Notify the observer about the start of the provisional load.
58 observer_->DidStartProvisionalLoad(
59 frame_id, parent_frame_id, is_main_frame, validated_url, is_error_page,
60 is_iframe_srcdoc, render_frame_host);
61
62 if (is_main_frame) {
63 // Notify the observer about the provisional change in the main frame URL.
64 observer_->ProvisionalChangeToMainFrameUrl(
65 validated_url, render_frame_host);
66 }
67 }
68
69 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698