Commit a0bbf4e4 authored by clamy's avatar clamy Committed by Commit Bot

Remove usage of GetActiveEntry [13/n]

This CL is part of a serie of CLs to remove usage of the deprecated
method NavigationController::GetActiveEntry.

Bug: 273710
Change-Id: Id79dff30a1718ffc18a6470efbd308ed02fdfe18
Reviewed-on: https://chromium-review.googlesource.com/1102515
Commit-Queue: Camille Lamy <clamy@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#571871}
parent a1525a85
......@@ -1617,8 +1617,14 @@ bool Browser::ShouldFocusLocationBarByDefault(WebContents* source) {
if (source != tab_strip_model_->GetActiveWebContents())
return false;
// This should be based on the pending entry if there is one, so that
// back/forward navigations to the NTP are handled. The visible entry can't
// be used here, since back/forward navigations are not treated as visible
// entries to avoid URL spoofs.
const content::NavigationEntry* entry =
source->GetController().GetActiveEntry();
source->GetController().GetPendingEntry()
? source->GetController().GetPendingEntry()
: source->GetController().GetLastCommittedEntry();
if (entry) {
const GURL& url = entry->GetURL();
const GURL& virtual_url = entry->GetVirtualURL();
......
......@@ -92,7 +92,7 @@ void MaybeShowExtensionControlledNewTabPage(
browser->profile());
content::NavigationEntry* entry =
web_contents->GetController().GetActiveEntry();
web_contents->GetController().GetVisibleEntry();
if (!entry)
return;
GURL active_url = entry->GetURL();
......
......@@ -53,7 +53,8 @@ static void EncodePinnedTab(TabStripModel* model,
std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue());
content::WebContents* web_contents = model->GetWebContentsAt(index);
NavigationEntry* entry = web_contents->GetController().GetActiveEntry();
NavigationEntry* entry =
web_contents->GetController().GetLastCommittedEntry();
if (entry) {
value->SetString(kURL, entry->GetURL().spec());
values->Append(std::move(value));
......
......@@ -136,7 +136,8 @@ class MediaRouterUIBrowserTest : public InProcessBrowserTest {
MediaRouterDialogController::GetOrCreateForWebContents(
browser()->tab_strip_model()->GetActiveWebContents());
content::ContextMenuParams params;
params.page_url = web_contents->GetController().GetActiveEntry()->GetURL();
params.page_url =
web_contents->GetController().GetLastCommittedEntry()->GetURL();
TestRenderViewContextMenu menu(web_contents->GetMainFrame(), params);
menu.Init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment