| Index: content/browser/renderer_host/navigator.cc
|
| diff --git a/content/browser/renderer_host/navigator.cc b/content/browser/renderer_host/navigator.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..3b336866be4de20c24fe4d1178c0401ac2313a36
|
| --- /dev/null
|
| +++ b/content/browser/renderer_host/navigator.cc
|
| @@ -0,0 +1,69 @@
|
| +// Copyright 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "content/browser/renderer_host/navigator.h"
|
| +
|
| +#include "content/browser/renderer_host/navigator_observer.h"
|
| +#include "content/browser/renderer_host/render_frame_host_impl.h"
|
| +#include "content/browser/site_instance_impl.h"
|
| +#include "content/browser/web_contents/navigation_controller_impl.h"
|
| +#include "content/browser/web_contents/navigation_entry_impl.h"
|
| +#include "content/public/browser/browser_context.h"
|
| +#include "content/public/browser/invalidate_type.h"
|
| +#include "content/public/browser/navigation_controller.h"
|
| +#include "content/public/browser/render_view_host.h"
|
| +#include "content/public/common/url_constants.h"
|
| +
|
| +namespace content {
|
| +
|
| +void Navigator::DidStartProvisionalLoad(
|
| + RenderFrameHost* render_frame_host,
|
| + int64 frame_id,
|
| + int64 parent_frame_id,
|
| + bool is_main_frame,
|
| + const GURL& url) {
|
| + bool is_error_page = (url.spec() == kUnreachableWebDataURL);
|
| + bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL);
|
| + GURL validated_url(url);
|
| + RenderProcessHost* render_process_host =
|
| + render_frame_host->GetProcess();
|
| + RenderViewHost::FilterURL(render_process_host, false, &validated_url);
|
| +
|
| + if (is_main_frame) {
|
| + // If there is no browser-initiated pending entry for this navigation and it
|
| + // is not for the error URL, create a pending entry using the current
|
| + // SiteInstance, and ensure the address bar updates accordingly. We don't
|
| + // know the referrer or extra headers at this point, but the referrer will
|
| + // be set properly upon commit.
|
| + NavigationEntry* pending_entry = controller_->GetPendingEntry();
|
| + bool has_browser_initiated_pending_entry = pending_entry &&
|
| + !NavigationEntryImpl::FromNavigationEntry(pending_entry)->
|
| + is_renderer_initiated();
|
| + if (!has_browser_initiated_pending_entry && !is_error_page) {
|
| + NavigationEntryImpl* entry = NavigationEntryImpl::FromNavigationEntry(
|
| + controller_->CreateNavigationEntry(validated_url,
|
| + content::Referrer(),
|
| + content::PAGE_TRANSITION_LINK,
|
| + true /* is_renderer_initiated */,
|
| + std::string(),
|
| + controller_->GetBrowserContext()));
|
| + render_frame_host->GetSiteInstance();
|
| + controller_->SetPendingEntry(entry);
|
| + observer_->NavigationStateChanged(content::INVALIDATE_TYPE_URL);
|
| + }
|
| + }
|
| +
|
| + // Notify the observer about the start of the provisional load.
|
| + observer_->DidStartProvisionalLoad(
|
| + frame_id, parent_frame_id, is_main_frame, validated_url, is_error_page,
|
| + is_iframe_srcdoc, render_frame_host);
|
| +
|
| + if (is_main_frame) {
|
| + // Notify the observer about the provisional change in the main frame URL.
|
| + observer_->ProvisionalChangeToMainFrameUrl(
|
| + validated_url, render_frame_host);
|
| + }
|
| +}
|
| +
|
| +} // namespace content
|
|
|