| Index: content/browser/web_contents/web_contents_impl.cc
|
| diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
|
| index 9a57c91991f2040fd0d0ddf77f708f828795fe02..20611e3b7cf5b0c5005e8e661d3f0acc87253002 100644
|
| --- a/content/browser/web_contents/web_contents_impl.cc
|
| +++ b/content/browser/web_contents/web_contents_impl.cc
|
| @@ -910,7 +910,7 @@ void WebContentsImpl::SetUserAgentOverride(const std::string& override) {
|
|
|
| // Reload the page if a load is currently in progress to avoid having
|
| // different parts of the page loaded using different user agents.
|
| - NavigationEntry* entry = controller_.GetActiveEntry();
|
| + NavigationEntry* entry = controller_.GetVisibleEntry();
|
| if (is_loading_ && entry != NULL && entry->GetIsOverridingUserAgent())
|
| controller_.ReloadIgnoringCache(true);
|
|
|
| @@ -1965,7 +1965,7 @@ void WebContentsImpl::SaveFrame(const GURL& url,
|
| return;
|
| int64 post_id = -1;
|
| if (is_main_frame) {
|
| - const NavigationEntry* entry = controller_.GetActiveEntry();
|
| + const NavigationEntry* entry = controller_.GetLastCommittedEntry();
|
| if (entry)
|
| post_id = entry->GetPostID();
|
| }
|
| @@ -1986,12 +1986,13 @@ void WebContentsImpl::GenerateMHTML(
|
| MHTMLGenerationManager::GetInstance()->SaveMHTML(this, file, callback);
|
| }
|
|
|
| +// TODO(nasko): Rename this method to IsVisibleEntry.
|
| bool WebContentsImpl::IsActiveEntry(int32 page_id) {
|
| - NavigationEntryImpl* active_entry =
|
| - NavigationEntryImpl::FromNavigationEntry(controller_.GetActiveEntry());
|
| - return (active_entry != NULL &&
|
| - active_entry->site_instance() == GetSiteInstance() &&
|
| - active_entry->GetPageID() == page_id);
|
| + NavigationEntryImpl* visible_entry =
|
| + NavigationEntryImpl::FromNavigationEntry(controller_.GetVisibleEntry());
|
| + return (visible_entry != NULL &&
|
| + visible_entry->site_instance() == GetSiteInstance() &&
|
| + visible_entry->GetPageID() == page_id);
|
| }
|
|
|
| const std::string& WebContentsImpl::GetContentsMimeType() const {
|
| @@ -2073,10 +2074,10 @@ double WebContentsImpl::GetZoomLevel() const {
|
| GetRenderProcessHost()->GetID(), GetRenderViewHost()->GetRoutingID());
|
| } else {
|
| GURL url;
|
| - NavigationEntry* active_entry = GetController().GetActiveEntry();
|
| + NavigationEntry* entry = GetController().GetLastCommittedEntry();
|
| // Since zoom map is updated using rewritten URL, use rewritten URL
|
| // to get the zoom level.
|
| - url = active_entry ? active_entry->GetURL() : GURL::EmptyGURL();
|
| + url = entry ? entry->GetURL() : GURL::EmptyGURL();
|
| zoom_level = zoom_map->GetZoomLevelForHostAndScheme(url.scheme(),
|
| net::GetHostOrSpecFromURL(url));
|
| }
|
| @@ -2099,11 +2100,11 @@ void WebContentsImpl::ViewSource() {
|
| if (!delegate_)
|
| return;
|
|
|
| - NavigationEntry* active_entry = GetController().GetActiveEntry();
|
| - if (!active_entry)
|
| + NavigationEntry* entry = GetController().GetLastCommittedEntry();
|
| + if (!entry)
|
| return;
|
|
|
| - delegate_->ViewSourceForTab(this, active_entry->GetURL());
|
| + delegate_->ViewSourceForTab(this, entry->GetURL());
|
| }
|
|
|
| void WebContentsImpl::ViewFrameSource(const GURL& url,
|
| @@ -2158,7 +2159,7 @@ int WebContentsImpl::DownloadImage(const GURL& url,
|
| }
|
|
|
| bool WebContentsImpl::FocusLocationBarByDefault() {
|
| - NavigationEntry* entry = controller_.GetActiveEntry();
|
| + NavigationEntry* entry = controller_.GetVisibleEntry();
|
| if (entry && entry->GetURL() == GURL(kAboutBlankURL))
|
| return true;
|
| return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this);
|
| @@ -2924,7 +2925,7 @@ void WebContentsImpl::RenderViewCreated(RenderViewHost* render_view_host) {
|
| if (render_manager_.pending_web_ui())
|
| render_manager_.pending_web_ui()->RenderViewCreated(render_view_host);
|
|
|
| - NavigationEntry* entry = controller_.GetActiveEntry();
|
| + NavigationEntry* entry = controller_.GetPendingEntry();
|
| if (entry && entry->IsViewSourceMode()) {
|
| // Put the renderer in view source mode.
|
| render_view_host->Send(
|
| @@ -3081,7 +3082,7 @@ void WebContentsImpl::DidNavigate(
|
| // forward in the history is only stored in the navigation controller's
|
| // entry list.
|
| if (did_navigate &&
|
| - (controller_.GetActiveEntry()->GetTransitionType() &
|
| + (controller_.GetLastCommittedEntry()->GetTransitionType() &
|
| PAGE_TRANSITION_FORWARD_BACK)) {
|
| transition_type = PageTransitionFromInt(
|
| params.transition | PAGE_TRANSITION_FORWARD_BACK);
|
| @@ -3500,8 +3501,10 @@ bool WebContentsImpl::AddMessageToConsole(int32 level,
|
| }
|
|
|
| WebPreferences WebContentsImpl::GetWebkitPrefs() {
|
| - // We want to base the page config off of the real URL, rather than the
|
| - // display URL.
|
| + // We want to base the page config off of the actual URL, rather than the
|
| + // virtual URL.
|
| + // TODO(nasko): Investigate how to remove the GetActiveEntry usage here,
|
| + // as it is deprecated and can be out of sync with GetRenderViewHost().
|
| GURL url = controller_.GetActiveEntry()
|
| ? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL();
|
| return GetWebkitPrefs(GetRenderViewHost(), url);
|
|
|