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

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

Issue 23200006: Don't show the search-by-image menu item when the image is blocked (no image pixel data) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: use ContextMenuParams::has_image_contents to check image's availability Created 7 years, 4 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/tab_contents/render_view_context_menu.cc
===================================================================
--- chrome/browser/tab_contents/render_view_context_menu.cc (revision 218359)
+++ chrome/browser/tab_contents/render_view_context_menu.cc (working copy)
@@ -865,7 +865,8 @@
const TemplateURL* const default_provider =
TemplateURLServiceFactory::GetForProfile(profile_)->
GetDefaultSearchProvider();
- if (default_provider && !default_provider->image_url().empty() &&
+ if (params_.has_image_contents && default_provider &&
+ !default_provider->image_url().empty() &&
default_provider->image_url_ref().IsValid()) {
menu_model_.AddItem(
IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE,
@@ -1288,7 +1289,7 @@
(params_.src_url.scheme() != chrome::kChromeUIScheme);
case IDC_CONTENT_CONTEXT_COPYIMAGE:
- return !params_.is_image_blocked;
+ return params_.has_image_contents;
// Media control commands should all be disabled if the player is in an
// error state.
@@ -1363,7 +1364,6 @@
// the page) from the NavigationEntry because its reflects their origin
// rather than the display one (returned by GetURL) which may be
// different (like having "view-source:" on the front).
- // TODO(nasko): Audit all GetActiveEntry calls in this file.
NavigationEntry* active_entry =
source_web_contents_->GetController().GetActiveEntry();
return content::IsSavableURL(
@@ -1797,9 +1797,7 @@
case IDC_CONTENT_CONTEXT_VIEWPAGEINFO: {
NavigationController* controller = &source_web_contents_->GetController();
- // Important to use GetVisibleEntry to match what's showing in the
- // omnibox.
- NavigationEntry* nav_entry = controller->GetVisibleEntry();
+ NavigationEntry* nav_entry = controller->GetActiveEntry();
Peter Kasting 2013/08/20 18:33:16 Is this change correct? It looks surprising to me
Browser* browser =
chrome::FindBrowserWithWebContents(source_web_contents_);
chrome::ShowWebsiteSettings(browser, source_web_contents_,

Powered by Google App Engine
This is Rietveld 408576698