Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Unified Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1309323004: Create a NavigationEntry for the initial blank page. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GetEntryCount, more tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_context_menu/render_view_context_menu.cc
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 58c38603bc9b9e6ae64344d07ccfbd529ca08126..50f326aeda52833f211e4db4ac4110ac94e2be3c 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -1163,7 +1163,8 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
return IsDevCommandEnabled(id);
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO:
- if (embedder_web_contents_->GetController().GetVisibleEntry() == NULL)
+ // Disabled for initial navigation.
+ if (embedder_web_contents_->GetController().IsInitialNavigation())
return false;
// Disabled if no browser is associated (e.g. desktop notifications).
if (chrome::FindBrowserWithWebContents(embedder_web_contents_) == NULL)
@@ -1314,7 +1315,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const {
// opposed to any pending URL that hasn't committed yet.
NavigationEntry* entry =
embedder_web_contents_->GetController().GetLastCommittedEntry();
- return content::IsSavableURL(entry ? entry->GetURL() : GURL());
+ return content::IsSavableURL(entry->GetURL());
}
case IDC_CONTENT_CONTEXT_RELOADFRAME:
@@ -1734,10 +1735,8 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) {
NavigationController* controller =
&embedder_web_contents_->GetController();
// Important to use GetVisibleEntry to match what's showing in the
- // omnibox. This may return null.
+ // omnibox.
NavigationEntry* nav_entry = controller->GetVisibleEntry();
- if (!nav_entry)
- return;
Browser* browser =
chrome::FindBrowserWithWebContents(embedder_web_contents_);
SecurityStateModel* security_model =

Powered by Google App Engine
This is Rietveld 408576698