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 6946015097b93dacbf13a47ebc89046237c42918..79f4761fa23d846c00d5edf9486e0c532d16c391 100644 |
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc |
@@ -216,8 +216,10 @@ const struct UmaEnumCommandIdPair { |
{63, IDC_WRITING_DIRECTION_DEFAULT}, |
{64, IDC_WRITING_DIRECTION_LTR}, |
{65, IDC_WRITING_DIRECTION_RTL}, |
+ {66, IDC_CONTENT_CONTEXT_RELOAD_ORIGINAL_IMAGE}, |
// Add new items here and use |enum_id| from the next line. |
- {66, 0}, // Must be the last. Increment |enum_id| when new IDC was added. |
+ // Also, add new items to RenderViewContextMenuItem enum in histograms.xml. |
+ {67, 0}, // Must be the last. Increment |enum_id| when new IDC was added. |
}; |
// Collapses large ranges of ids before looking for UMA enum. |
@@ -698,6 +700,15 @@ void RenderViewContextMenu::AppendImageItems() { |
IDS_CONTENT_CONTEXT_COPYIMAGELOCATION); |
menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_COPYIMAGE, |
IDS_CONTENT_CONTEXT_COPYIMAGE); |
+ static const char lo_fi_header_key[] = "Chrome-Proxy"; |
jam
2015/05/15 06:52:19
ditto
megjablon
2015/05/15 20:31:08
Done.
|
+ static const char lo_fi_header_value[] = "q=low"; |
jam
2015/05/15 06:52:19
this should also be a constant shared with the ren
megjablon
2015/05/15 20:31:08
Done.
|
+ std::map<std::string, std::string>::const_iterator it = |
+ params_.properties.find(lo_fi_header_key); |
+ if (it != params_.properties.end() && it->second == lo_fi_header_value) { |
+ menu_model_.AddItemWithStringId( |
+ IDC_CONTENT_CONTEXT_RELOAD_ORIGINAL_IMAGE, |
+ IDS_CONTENT_CONTEXT_RELOAD_ORIGINAL_IMAGE); |
+ } |
DataReductionProxyChromeSettings* settings = |
DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
browser_context_); |
@@ -1118,6 +1129,7 @@ bool RenderViewContextMenu::IsCommandIdEnabled(int id) const { |
// The images shown in the most visited thumbnails can't be opened or |
// searched for conventionally. |
case IDC_CONTENT_CONTEXT_OPEN_ORIGINAL_IMAGE_NEW_TAB: |
+ case IDC_CONTENT_CONTEXT_RELOAD_ORIGINAL_IMAGE: |
case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: |
case IDC_CONTENT_CONTEXT_SEARCHWEBFORIMAGE: |
return params_.src_url.is_valid() && |
@@ -1433,6 +1445,10 @@ void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
data_reduction_proxy::kDataReductionPassThroughHeader); |
break; |
+ case IDC_CONTENT_CONTEXT_RELOAD_ORIGINAL_IMAGE: |
+ ReloadOriginalImage(); |
+ break; |
+ |
case IDC_CONTENT_CONTEXT_OPENIMAGENEWTAB: |
case IDC_CONTENT_CONTEXT_OPENAVNEWTAB: |
OpenURL(params_.src_url, |
@@ -1787,6 +1803,14 @@ void RenderViewContextMenu::CopyImageAt(int x, int y) { |
source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); |
} |
+void RenderViewContextMenu::ReloadOriginalImage() { |
+ RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
+ if (!render_frame_host) |
+ return; |
+ render_frame_host->Send(new ChromeViewMsg_RequestReloadImageForContextNode( |
+ render_frame_host->GetRoutingID())); |
+} |
+ |
void RenderViewContextMenu::GetImageThumbnailForSearch() { |
RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
if (!render_frame_host) |