Chromium Code Reviews| 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 bce18ad93cf29ac684cef3965122db77626a6a50..df6ba536153b6b3b24c75966c2b3d944c2d42da7 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -886,7 +886,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); |
| @@ -1927,7 +1927,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(); |
| } |
| @@ -1948,12 +1948,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 { |
| @@ -2035,10 +2036,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)); |
| } |
| @@ -2061,11 +2062,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, |
| @@ -2122,7 +2123,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); |
| @@ -2919,7 +2920,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(); |
|
Charlie Reis
2013/09/16 23:10:54
Your reply said you were changing this to LastComm
nasko
2013/09/18 17:03:18
I did change it to LastCommitted, but that broke t
|
| if (entry && entry->IsViewSourceMode()) { |
| // Put the renderer in view source mode. |
| render_view_host->Send( |
| @@ -3084,7 +3085,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); |
| @@ -3515,8 +3516,8 @@ 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. |
| - GURL url = controller_.GetActiveEntry() |
| - ? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL(); |
| + GURL url = controller_.GetLastCommittedEntry() |
| + ? controller_.GetLastCommittedEntry()->GetURL() : GURL::EmptyGURL(); |
| return GetWebkitPrefs(GetRenderViewHost(), url); |
| } |