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 ab77559add0cbaab6344d28e9c8a403e1f1938c6..71c0b920500619ac6f6b556aacfcc57e96e0516b 100644 |
| --- a/content/browser/web_contents/web_contents_impl.cc |
| +++ b/content/browser/web_contents/web_contents_impl.cc |
| @@ -908,7 +908,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); |
| @@ -1963,7 +1963,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(); |
| } |
| @@ -1984,12 +1984,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 { |
| @@ -2071,10 +2072,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)); |
| } |
| @@ -2097,11 +2098,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, |
| @@ -2156,7 +2157,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); |
| @@ -2916,7 +2917,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( |
| @@ -3073,7 +3074,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); |
| @@ -3502,8 +3503,8 @@ bool WebContentsImpl::AddMessageToConsole(int32 level, |
| WebPreferences WebContentsImpl::GetWebkitPrefs() { |
| // We want to base the page config off of the real URL, rather than the |
|
Charlie Reis
2013/10/04 18:42:46
This "real URL" vs "display URL" is a bit confusin
|
| // display URL. |
| - GURL url = controller_.GetActiveEntry() |
| - ? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL(); |
| + GURL url = controller_.GetVisibleEntry() |
| + ? controller_.GetVisibleEntry()->GetURL() : GURL::EmptyGURL(); |
| return GetWebkitPrefs(GetRenderViewHost(), url); |
|
Charlie Reis
2013/10/04 18:42:46
I had a comment on the original review that this l
|
| } |