Chromium Code Reviews| OLD | NEW |
|---|---|
| (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/frame_host/navigator.h" | |
| 6 | |
| 7 #include "content/browser/frame_host/navigation_controller_impl.h" | |
| 8 #include "content/browser/frame_host/navigation_entry_impl.h" | |
| 9 #include "content/browser/frame_host/navigator_delegate.h" | |
| 10 #include "content/browser/frame_host/render_frame_host_impl.h" | |
| 11 #include "content/browser/site_instance_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 Navigator::Navigator( | |
| 21 NavigationControllerImpl* nav_controller, | |
| 22 NavigatorDelegate* delegate) | |
| 23 : controller_(nav_controller), | |
| 24 delegate_(delegate) { | |
| 25 } | |
| 26 | |
| 27 void Navigator::DidStartProvisionalLoad( | |
|
Charlie Reis
2013/11/07 01:22:43
Reminder to update this from the latest state of D
| |
| 28 RenderFrameHost* render_frame_host, | |
| 29 int64 frame_id, | |
| 30 int64 parent_frame_id, | |
| 31 bool is_main_frame, | |
| 32 const GURL& url) { | |
| 33 bool is_error_page = (url.spec() == kUnreachableWebDataURL); | |
| 34 bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); | |
| 35 GURL validated_url(url); | |
| 36 RenderProcessHost* render_process_host = | |
| 37 render_frame_host->GetProcess(); | |
| 38 RenderViewHost::FilterURL(render_process_host, false, &validated_url); | |
| 39 | |
| 40 if (is_main_frame) { | |
| 41 // If there is no browser-initiated pending entry for this navigation and it | |
| 42 // is not for the error URL, create a pending entry using the current | |
| 43 // SiteInstance, and ensure the address bar updates accordingly. We don't | |
| 44 // know the referrer or extra headers at this point, but the referrer will | |
| 45 // be set properly upon commit. | |
| 46 NavigationEntry* pending_entry = controller_->GetPendingEntry(); | |
| 47 bool has_browser_initiated_pending_entry = pending_entry && | |
| 48 !NavigationEntryImpl::FromNavigationEntry(pending_entry)-> | |
| 49 is_renderer_initiated(); | |
| 50 if (!has_browser_initiated_pending_entry && !is_error_page) { | |
| 51 NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry( | |
| 52 controller_->CreateNavigationEntry(validated_url, | |
| 53 content::Referrer(), | |
| 54 content::PAGE_TRANSITION_LINK, | |
| 55 true /* is_renderer_initiated */, | |
| 56 std::string(), | |
| 57 controller_->GetBrowserContext())); | |
| 58 render_frame_host->GetSiteInstance(); | |
| 59 controller_->SetPendingEntry(entry); | |
| 60 delegate_->NotifyNavigationStateChanged(content::INVALIDATE_TYPE_URL); | |
| 61 } | |
| 62 } | |
| 63 | |
| 64 // Notify the observer about the start of the provisional load. | |
| 65 delegate_->DidStartProvisionalLoad( | |
| 66 frame_id, parent_frame_id, is_main_frame, validated_url, is_error_page, | |
| 67 is_iframe_srcdoc, render_frame_host); | |
| 68 | |
| 69 if (is_main_frame) { | |
| 70 // Notify the observer about the provisional change in the main frame URL. | |
| 71 delegate_->ProvisionalChangeToMainFrameUrl( | |
| 72 validated_url, render_frame_host); | |
| 73 } | |
| 74 } | |
| 75 | |
| 76 } // namespace content | |
| OLD | NEW |