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

Side by Side Diff: chrome/browser/renderer_context_menu/render_view_context_menu.cc

Issue 1836973003: Move download messages from Renderer to Frame filter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after
1842 SaveLinkAs(); 1842 SaveLinkAs();
1843 break; 1843 break;
1844 1844
1845 case IDC_CONTENT_CONTEXT_SAVEAVAS: 1845 case IDC_CONTENT_CONTEXT_SAVEAVAS:
1846 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { 1846 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: {
1847 bool is_large_data_url = params_.has_image_contents && 1847 bool is_large_data_url = params_.has_image_contents &&
1848 params_.src_url.is_empty(); 1848 params_.src_url.is_empty();
1849 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || 1849 if (params_.media_type == WebContextMenuData::MediaTypeCanvas ||
1850 (params_.media_type == WebContextMenuData::MediaTypeImage && 1850 (params_.media_type == WebContextMenuData::MediaTypeImage &&
1851 is_large_data_url)) { 1851 is_large_data_url)) {
1852 source_web_contents_->GetRenderViewHost()->SaveImageAt( 1852 RenderFrameHost* frame_host = GetRenderFrameHost();
1853 params_.x, params_.y); 1853 if (frame_host)
1854 frame_host->SaveImageAt(params_.x, params_.y);
1854 } else { 1855 } else {
1855 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); 1856 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU);
1856 const GURL& url = params_.src_url; 1857 const GURL& url = params_.src_url;
1857 content::Referrer referrer = CreateReferrer(url, params_); 1858 content::Referrer referrer = CreateReferrer(url, params_);
1858 1859
1859 std::string headers; 1860 std::string headers;
1860 DataReductionProxyChromeSettings* settings = 1861 DataReductionProxyChromeSettings* settings =
1861 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( 1862 DataReductionProxyChromeSettingsFactory::GetForBrowserContext(
1862 browser_context_); 1863 browser_context_);
1863 if (params_.media_type == WebContextMenuData::MediaTypeImage && 1864 if (params_.media_type == WebContextMenuData::MediaTypeImage &&
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2258 } 2259 }
2259 2260
2260 void RenderViewContextMenu::EscapeAmpersands(base::string16* text) { 2261 void RenderViewContextMenu::EscapeAmpersands(base::string16* text) {
2261 base::ReplaceChars(*text, base::ASCIIToUTF16("&"), base::ASCIIToUTF16("&&"), 2262 base::ReplaceChars(*text, base::ASCIIToUTF16("&"), base::ASCIIToUTF16("&&"),
2262 text); 2263 text);
2263 } 2264 }
2264 2265
2265 // Controller functions -------------------------------------------------------- 2266 // Controller functions --------------------------------------------------------
2266 2267
2267 void RenderViewContextMenu::CopyImageAt(int x, int y) { 2268 void RenderViewContextMenu::CopyImageAt(int x, int y) {
2268 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); 2269 RenderFrameHost* frame_host = GetRenderFrameHost();
2270 if (frame_host)
2271 frame_host->CopyImageAt(x, y);
2269 } 2272 }
2270 2273
2271 void RenderViewContextMenu::LoadOriginalImage() { 2274 void RenderViewContextMenu::LoadOriginalImage() {
2272 RenderFrameHost* render_frame_host = GetRenderFrameHost(); 2275 RenderFrameHost* render_frame_host = GetRenderFrameHost();
2273 if (!render_frame_host) 2276 if (!render_frame_host)
2274 return; 2277 return;
2275 render_frame_host->Send(new ChromeViewMsg_RequestReloadImageForContextNode( 2278 render_frame_host->Send(new ChromeViewMsg_RequestReloadImageForContextNode(
2276 render_frame_host->GetRoutingID())); 2279 render_frame_host->GetRoutingID()));
2277 } 2280 }
2278 2281
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2333 source_web_contents_->GetRenderViewHost()-> 2336 source_web_contents_->GetRenderViewHost()->
2334 ExecuteMediaPlayerActionAtLocation(location, action); 2337 ExecuteMediaPlayerActionAtLocation(location, action);
2335 } 2338 }
2336 2339
2337 void RenderViewContextMenu::PluginActionAt( 2340 void RenderViewContextMenu::PluginActionAt(
2338 const gfx::Point& location, 2341 const gfx::Point& location,
2339 const WebPluginAction& action) { 2342 const WebPluginAction& action) {
2340 source_web_contents_->GetRenderViewHost()-> 2343 source_web_contents_->GetRenderViewHost()->
2341 ExecutePluginActionAtLocation(location, action); 2344 ExecutePluginActionAtLocation(location, action);
2342 } 2345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698