Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1303 return extension_items_.IsCommandIdChecked(id); | 1303 return extension_items_.IsCommandIdChecked(id); |
| 1304 | 1304 |
| 1305 return false; | 1305 return false; |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { | 1308 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
| 1309 RenderViewContextMenuBase::ExecuteCommand(id, event_flags); | 1309 RenderViewContextMenuBase::ExecuteCommand(id, event_flags); |
| 1310 if (command_executed_) | 1310 if (command_executed_) |
| 1311 return; | 1311 return; |
| 1312 command_executed_ = true; | 1312 command_executed_ = true; |
| 1313 | |
|
Avi (use Gerrit)
2015/03/06 23:55:20
Why drop the space here?
Not at Google. Contact bengr
2015/03/07 00:45:02
Done.
| |
| 1314 RenderFrameHost* render_frame_host = GetRenderFrameHost(); | 1313 RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
| 1315 | 1314 |
| 1316 // Process extension menu items. | 1315 // Process extension menu items. |
| 1317 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) { | 1316 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) { |
| 1318 extension_items_.ExecuteCommand(id, source_web_contents_, params_); | 1317 extension_items_.ExecuteCommand(id, source_web_contents_, params_); |
| 1319 return; | 1318 return; |
| 1320 } | 1319 } |
| 1321 | 1320 |
| 1322 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && | 1321 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && |
| 1323 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { | 1322 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1383 params_.src_url.is_empty(); | 1382 params_.src_url.is_empty(); |
| 1384 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || | 1383 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || |
| 1385 (params_.media_type == WebContextMenuData::MediaTypeImage && | 1384 (params_.media_type == WebContextMenuData::MediaTypeImage && |
| 1386 is_large_data_url)) { | 1385 is_large_data_url)) { |
| 1387 source_web_contents_->GetRenderViewHost()->SaveImageAt( | 1386 source_web_contents_->GetRenderViewHost()->SaveImageAt( |
| 1388 params_.x, params_.y); | 1387 params_.x, params_.y); |
| 1389 } else { | 1388 } else { |
| 1390 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); | 1389 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); |
| 1391 const GURL& url = params_.src_url; | 1390 const GURL& url = params_.src_url; |
| 1392 content::Referrer referrer = CreateSaveAsReferrer(url, params_); | 1391 content::Referrer referrer = CreateSaveAsReferrer(url, params_); |
| 1393 source_web_contents_->SaveFrame(url, referrer); | 1392 |
| 1393 std::string headers; | |
| 1394 if (params_.media_type == WebContextMenuData::MediaTypeImage && | |
| 1395 !browser_context_->IsOffTheRecord() && | |
| 1396 DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | |
| 1397 browser_context_)->CanUseDataReductionProxy( | |
| 1398 params_.src_url)) { | |
| 1399 headers = data_reduction_proxy::kDataReductionPassThroughHeader; | |
| 1400 } | |
| 1401 | |
| 1402 source_web_contents_->SaveFrameWithHeaders(url, referrer, headers); | |
| 1394 } | 1403 } |
| 1395 break; | 1404 break; |
| 1396 } | 1405 } |
| 1397 | 1406 |
| 1398 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: | 1407 case IDC_CONTENT_CONTEXT_COPYLINKLOCATION: |
| 1399 WriteURLToClipboard(params_.unfiltered_link_url); | 1408 WriteURLToClipboard(params_.unfiltered_link_url); |
| 1400 break; | 1409 break; |
| 1401 | 1410 |
| 1402 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: | 1411 case IDC_CONTENT_CONTEXT_COPYIMAGELOCATION: |
| 1403 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: | 1412 case IDC_CONTENT_CONTEXT_COPYAVLOCATION: |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1804 source_web_contents_->GetRenderViewHost()-> | 1813 source_web_contents_->GetRenderViewHost()-> |
| 1805 ExecuteMediaPlayerActionAtLocation(location, action); | 1814 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1806 } | 1815 } |
| 1807 | 1816 |
| 1808 void RenderViewContextMenu::PluginActionAt( | 1817 void RenderViewContextMenu::PluginActionAt( |
| 1809 const gfx::Point& location, | 1818 const gfx::Point& location, |
| 1810 const WebPluginAction& action) { | 1819 const WebPluginAction& action) { |
| 1811 source_web_contents_->GetRenderViewHost()-> | 1820 source_web_contents_->GetRenderViewHost()-> |
| 1812 ExecutePluginActionAtLocation(location, action); | 1821 ExecutePluginActionAtLocation(location, action); |
| 1813 } | 1822 } |
| OLD | NEW |