| 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 1365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1376 dl_params->set_referrer(referrer); | 1376 dl_params->set_referrer(referrer); |
| 1377 dl_params->set_referrer_encoding(params_.frame_charset); | 1377 dl_params->set_referrer_encoding(params_.frame_charset); |
| 1378 dl_params->set_suggested_name(params_.suggested_filename); | 1378 dl_params->set_suggested_name(params_.suggested_filename); |
| 1379 dl_params->set_prompt(true); | 1379 dl_params->set_prompt(true); |
| 1380 dlm->DownloadUrl(dl_params.Pass()); | 1380 dlm->DownloadUrl(dl_params.Pass()); |
| 1381 break; | 1381 break; |
| 1382 } | 1382 } |
| 1383 | 1383 |
| 1384 case IDC_CONTENT_CONTEXT_SAVEAVAS: | 1384 case IDC_CONTENT_CONTEXT_SAVEAVAS: |
| 1385 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { | 1385 case IDC_CONTENT_CONTEXT_SAVEIMAGEAS: { |
| 1386 embedder_web_contents_->SaveImage(); |
| 1386 bool is_large_data_url = params_.has_image_contents && | 1387 bool is_large_data_url = params_.has_image_contents && |
| 1387 params_.src_url.is_empty(); | 1388 params_.src_url.is_empty(); |
| 1388 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || | 1389 if (params_.media_type == WebContextMenuData::MediaTypeCanvas || |
| 1389 (params_.media_type == WebContextMenuData::MediaTypeImage && | 1390 (params_.media_type == WebContextMenuData::MediaTypeImage && |
| 1390 is_large_data_url)) { | 1391 is_large_data_url)) { |
| 1391 source_web_contents_->GetRenderViewHost()->SaveImageAt( | 1392 source_web_contents_->GetRenderViewHost()->SaveImageAt( |
| 1392 params_.x, params_.y); | 1393 params_.x, params_.y); |
| 1393 } else { | 1394 } else { |
| 1394 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); | 1395 RecordDownloadSource(DOWNLOAD_INITIATED_BY_CONTEXT_MENU); |
| 1395 const GURL& url = params_.src_url; | 1396 const GURL& url = params_.src_url; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1531 const Extension* platform_app = GetExtension(); | 1532 const Extension* platform_app = GetExtension(); |
| 1532 DCHECK(platform_app); | 1533 DCHECK(platform_app); |
| 1533 DCHECK(platform_app->is_platform_app()); | 1534 DCHECK(platform_app->is_platform_app()); |
| 1534 | 1535 |
| 1535 apps::AppLoadService::Get(GetProfile()) | 1536 apps::AppLoadService::Get(GetProfile()) |
| 1536 ->RestartApplication(platform_app->id()); | 1537 ->RestartApplication(platform_app->id()); |
| 1537 break; | 1538 break; |
| 1538 } | 1539 } |
| 1539 | 1540 |
| 1540 case IDC_PRINT: { | 1541 case IDC_PRINT: { |
| 1542 embedder_web_contents_->Print(); |
| 1541 #if defined(ENABLE_PRINTING) | 1543 #if defined(ENABLE_PRINTING) |
| 1542 if (params_.media_type != WebContextMenuData::MediaTypeNone) { | 1544 if (params_.media_type != WebContextMenuData::MediaTypeNone) { |
| 1543 if (render_frame_host) { | 1545 if (render_frame_host) { |
| 1544 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( | 1546 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( |
| 1545 render_frame_host->GetRoutingID())); | 1547 render_frame_host->GetRoutingID())); |
| 1546 } | 1548 } |
| 1547 break; | 1549 break; |
| 1548 } | 1550 } |
| 1549 | 1551 |
| 1550 printing::StartPrint( | 1552 printing::StartPrint( |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1818 source_web_contents_->GetRenderViewHost()-> | 1820 source_web_contents_->GetRenderViewHost()-> |
| 1819 ExecuteMediaPlayerActionAtLocation(location, action); | 1821 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1820 } | 1822 } |
| 1821 | 1823 |
| 1822 void RenderViewContextMenu::PluginActionAt( | 1824 void RenderViewContextMenu::PluginActionAt( |
| 1823 const gfx::Point& location, | 1825 const gfx::Point& location, |
| 1824 const WebPluginAction& action) { | 1826 const WebPluginAction& action) { |
| 1825 source_web_contents_->GetRenderViewHost()-> | 1827 source_web_contents_->GetRenderViewHost()-> |
| 1826 ExecutePluginActionAtLocation(location, action); | 1828 ExecutePluginActionAtLocation(location, action); |
| 1827 } | 1829 } |
| OLD | NEW |