diff options
-rw-r--r-- | chrome/browser/ui/browser.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_browsertest.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/browser_command_controller.cc | 2 | ||||
-rw-r--r-- | chrome/browser/ui/browser_commands.cc | 31 |
4 files changed, 19 insertions, 20 deletions
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index d85724d..c618f43 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -1466,7 +1466,7 @@ void Browser::BeforeUnloadFired(WebContents* web_contents, bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) { const content::NavigationEntry* entry = - source->GetController().GetActiveEntry(); + source->GetController().GetVisibleEntry(); if (entry) { GURL url = entry->GetURL(); GURL virtual_url = entry->GetVirtualURL(); diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc index e62b954..aba8e8d 100644 --- a/chrome/browser/ui/browser_browsertest.cc +++ b/chrome/browser/ui/browser_browsertest.cc @@ -1137,7 +1137,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, ui_test_utils::NavigateToURL(browser(), url); NavigationEntry* entry = browser()->tab_strip_model()-> - GetActiveWebContents()->GetController().GetActiveEntry(); + GetActiveWebContents()->GetController().GetVisibleEntry(); EXPECT_EQ(expected_favicon_url.spec(), entry->GetFavicon().url.spec()); } @@ -1157,7 +1157,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_FaviconChange) { ui_test_utils::NavigateToURL(browser(), file_url); NavigationEntry* entry = browser()->tab_strip_model()-> - GetActiveWebContents()->GetController().GetActiveEntry(); + GetActiveWebContents()->GetController().GetVisibleEntry(); static const base::FilePath::CharType* kIcon = FILE_PATH_LITERAL("test1.png"); GURL expected_favicon_url(ui_test_utils::GetTestUrl(base::FilePath( diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc index 5f646f1..b489ffb 100644 --- a/chrome/browser/ui/browser_command_controller.cc +++ b/chrome/browser/ui/browser_command_controller.cc @@ -1086,7 +1086,7 @@ void BrowserCommandController::UpdateCommandsForTabState() { // Changing the encoding is not possible on Chrome-internal webpages. NavigationController& nc = current_web_contents->GetController(); - bool is_chrome_internal = HasInternalURL(nc.GetActiveEntry()) || + bool is_chrome_internal = HasInternalURL(nc.GetLastCommittedEntry()) || current_web_contents->ShowingInterstitialPage(); command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, !is_chrome_internal && current_web_contents->IsSavable()); diff --git a/chrome/browser/ui/browser_commands.cc b/chrome/browser/ui/browser_commands.cc index 46eff2f..ca7d86f 100644 --- a/chrome/browser/ui/browser_commands.cc +++ b/chrome/browser/ui/browser_commands.cc @@ -256,11 +256,10 @@ 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()) || + if (!content::IsSavableURL(entry ? entry->GetURL() : GURL()) || current_tab->ShowingInterstitialPage()) content_restrictions |= CONTENT_RESTRICTION_SAVE; if (current_tab->ShowingInterstitialPage()) @@ -987,7 +986,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().GetLastCommittedEntry() != NULL; } bool IsRequestingTabletSite(Browser* browser) { @@ -995,7 +994,7 @@ bool IsRequestingTabletSite(Browser* browser) { if (!current_tab) return false; content::NavigationEntry* entry = - current_tab->GetController().GetActiveEntry(); + current_tab->GetController().GetLastCommittedEntry(); if (!entry) return false; return entry->GetIsOverridingUserAgent(); @@ -1006,7 +1005,7 @@ void ToggleRequestTabletSite(Browser* browser) { if (!current_tab) return; NavigationController& controller = current_tab->GetController(); - NavigationEntry* entry = controller.GetActiveEntry(); + NavigationEntry* entry = controller.GetLastCommittedEntry(); if (!entry) return; if (entry->GetIsOverridingUserAgent()) { @@ -1061,25 +1060,25 @@ void ViewSource(Browser* browser, content::RecordAction(UserMetricsAction("ViewSource")); DCHECK(contents); - // Note that Clone does not copy the pending or transient entries, so the - // active entry in view_source_contents will be the last committed entry. + // Note that Clone does not copy the pending or transient entries, so we can + // take the last committed entry in view_source_contents. WebContents* view_source_contents = contents->Clone(); DCHECK(view_source_contents->GetController().CanPruneAllButLastCommitted()); view_source_contents->GetController().PruneAllButLastCommitted(); - NavigationEntry* active_entry = - view_source_contents->GetController().GetActiveEntry(); - if (!active_entry) + NavigationEntry* entry = + view_source_contents->GetController().GetLastCommittedEntry(); + 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)) { @@ -1150,7 +1149,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); |