Chromium Code Reviews| Index: chrome/browser/ui/browser_commands.cc |
| diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc |
| index 9d6151a8d5372bf69327d20ec365fc8544c32283..56ce3b4445cf47962cac743d0b67cbfcc1855dd8 100644 |
| --- a/chrome/browser/ui/browser_commands.cc |
| +++ b/chrome/browser/ui/browser_commands.cc |
| @@ -254,11 +254,11 @@ int GetContentRestrictions(const Browser* browser) { |
| CoreTabHelper* core_tab_helper = |
| CoreTabHelper::FromWebContents(current_tab); |
| content_restrictions = core_tab_helper->content_restrictions(); |
| - NavigationEntry* active_entry = |
| - current_tab->GetController().GetActiveEntry(); |
| + NavigationEntry* entry = |
| + current_tab->GetController().GetLastCommittedEntry(); |
| // See comment in UpdateCommandsForTabState about why we call url(). |
| if (!content::IsSavableURL( |
| - active_entry ? active_entry->GetURL() : GURL()) || |
| + entry ? entry->GetURL() : GURL()) || |
| current_tab->ShowingInterstitialPage()) |
| content_restrictions |= CONTENT_RESTRICTION_SAVE; |
| if (current_tab->ShowingInterstitialPage()) |
| @@ -980,7 +980,7 @@ void ToggleSpeechInput(Browser* browser) { |
| bool CanRequestTabletSite(WebContents* current_tab) { |
| if (!current_tab) |
| return false; |
| - return current_tab->GetController().GetActiveEntry() != NULL; |
| + return current_tab->GetController().GetVisibleEntry() != NULL; |
|
nasko
2013/11/08 23:52:03
For this and the next two instances, have you trie
jww
2013/11/11 19:18:51
Done.
|
| } |
| bool IsRequestingTabletSite(Browser* browser) { |
| @@ -988,7 +988,7 @@ bool IsRequestingTabletSite(Browser* browser) { |
| if (!current_tab) |
| return false; |
| content::NavigationEntry* entry = |
| - current_tab->GetController().GetActiveEntry(); |
| + current_tab->GetController().GetVisibleEntry(); |
| if (!entry) |
| return false; |
| return entry->GetIsOverridingUserAgent(); |
| @@ -999,7 +999,7 @@ void ToggleRequestTabletSite(Browser* browser) { |
| if (!current_tab) |
| return; |
| NavigationController& controller = current_tab->GetController(); |
| - NavigationEntry* entry = controller.GetActiveEntry(); |
| + NavigationEntry* entry = controller.GetVisibleEntry(); |
| if (!entry) |
| return; |
| if (entry->GetIsOverridingUserAgent()) { |
| @@ -1059,20 +1059,20 @@ void ViewSource(Browser* browser, |
| WebContents* view_source_contents = contents->Clone(); |
| DCHECK(view_source_contents->GetController().CanPruneAllButVisible()); |
|
jww
2013/11/11 19:18:51
On a side note, this function seems woefully misna
Charlie Reis
2013/11/11 22:58:23
Wow, that is poorly named. I'll take the blame fo
|
| view_source_contents->GetController().PruneAllButVisible(); |
| - NavigationEntry* active_entry = |
| - view_source_contents->GetController().GetActiveEntry(); |
| - if (!active_entry) |
| + NavigationEntry* entry = |
| + view_source_contents->GetController().GetVisibleEntry(); |
|
nasko
2013/11/08 23:52:03
If the comment above is correct, why not use LastC
jww
2013/11/11 19:18:51
Done.
|
| + if (!entry) |
| return; |
| GURL view_source_url = |
| GURL(content::kViewSourceScheme + std::string(":") + url.spec()); |
| - active_entry->SetVirtualURL(view_source_url); |
| + entry->SetVirtualURL(view_source_url); |
| // Do not restore scroller position. |
| - active_entry->SetPageState(page_state.RemoveScrollOffset()); |
| + entry->SetPageState(page_state.RemoveScrollOffset()); |
| // Do not restore title, derive it from the url. |
| - active_entry->SetTitle(string16()); |
| + entry->SetTitle(string16()); |
| // Now show view-source entry. |
| if (browser->CanSupportWindowFeature(Browser::FEATURE_TABSTRIP)) { |
| @@ -1136,7 +1136,7 @@ bool CanCreateApplicationShortcuts(const Browser* browser) { |
| void ConvertTabToAppWindow(Browser* browser, |
| content::WebContents* contents) { |
| - const GURL& url = contents->GetController().GetActiveEntry()->GetURL(); |
| + const GURL& url = contents->GetController().GetLastCommittedEntry()->GetURL(); |
| std::string app_name = web_app::GenerateApplicationNameFromURL(url); |
| int index = browser->tab_strip_model()->GetIndexOfWebContents(contents); |