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 1460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1471 case IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP: { | 1471 case IDC_CONTENT_CONTEXT_RESTART_PACKAGED_APP: { |
1472 const Extension* platform_app = GetExtension(); | 1472 const Extension* platform_app = GetExtension(); |
1473 DCHECK(platform_app); | 1473 DCHECK(platform_app); |
1474 DCHECK(platform_app->is_platform_app()); | 1474 DCHECK(platform_app->is_platform_app()); |
1475 | 1475 |
1476 apps::AppLoadService::Get(GetProfile()) | 1476 apps::AppLoadService::Get(GetProfile()) |
1477 ->RestartApplication(platform_app->id()); | 1477 ->RestartApplication(platform_app->id()); |
1478 break; | 1478 break; |
1479 } | 1479 } |
1480 | 1480 |
1481 case IDC_PRINT: { | 1481 case IDC_PRINT: |
1482 #if defined(ENABLE_PRINTING) | 1482 #if defined(ENABLE_PRINTING) |
1483 if (params_.media_type != WebContextMenuData::MediaTypeNone) { | 1483 if (params_.media_type == WebContextMenuData::MediaTypeNone) { |
| 1484 #if defined(ENABLE_FULL_PRINTING) |
| 1485 printing::PrintViewManager* print_view_manager = |
| 1486 printing::PrintViewManager::FromWebContents(source_web_contents_); |
| 1487 |
| 1488 if (!print_view_manager) |
| 1489 break; |
| 1490 print_view_manager->PrintPreviewNow(!params_.selection_text.empty()); |
| 1491 #else |
| 1492 printing::PrintViewManagerBasic* print_view_manager = |
| 1493 printing::PrintViewManagerBasic::FromWebContents( |
| 1494 source_web_contents_); |
| 1495 if (!print_view_manager) |
| 1496 break; |
| 1497 print_view_manager->PrintNow(); |
| 1498 #endif // defined(ENABLE_FULL_PRINTING) |
| 1499 } else { |
1484 if (render_frame_host) { | 1500 if (render_frame_host) { |
1485 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( | 1501 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( |
1486 render_frame_host->GetRoutingID())); | 1502 render_frame_host->GetRoutingID())); |
1487 } | 1503 } |
1488 return; | |
1489 } | 1504 } |
1490 | 1505 #endif // defined(ENABLE_PRINTING) |
1491 printing::PrintViewManager* print_view_manager = | |
1492 printing::PrintViewManager::FromWebContents(source_web_contents_); | |
1493 if (!print_view_manager) | |
1494 break; | |
1495 | |
1496 #if defined(ENABLE_FULL_PRINTING) | |
1497 if (!GetPrefs(browser_context_) | |
1498 ->GetBoolean(prefs::kPrintPreviewDisabled)) { | |
1499 print_view_manager->PrintPreviewNow(!params_.selection_text.empty()); | |
1500 break; | |
1501 } | |
1502 #endif // ENABLE_FULL_PRINTING | |
1503 | |
1504 #if !defined(DISABLE_BASIC_PRINTING) | |
1505 print_view_manager->PrintNow(); | |
1506 #endif // !DISABLE_BASIC_PRINTING | |
1507 | |
1508 #endif // ENABLE_PRINTING | |
1509 break; | 1506 break; |
1510 } | |
1511 | 1507 |
1512 case IDC_VIEW_SOURCE: | 1508 case IDC_VIEW_SOURCE: |
1513 source_web_contents_->ViewSource(); | 1509 source_web_contents_->ViewSource(); |
1514 break; | 1510 break; |
1515 | 1511 |
1516 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | 1512 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: |
1517 Inspect(params_.x, params_.y); | 1513 Inspect(params_.x, params_.y); |
1518 break; | 1514 break; |
1519 | 1515 |
1520 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: { | 1516 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 source_web_contents_->GetRenderViewHost()-> | 1769 source_web_contents_->GetRenderViewHost()-> |
1774 ExecuteMediaPlayerActionAtLocation(location, action); | 1770 ExecuteMediaPlayerActionAtLocation(location, action); |
1775 } | 1771 } |
1776 | 1772 |
1777 void RenderViewContextMenu::PluginActionAt( | 1773 void RenderViewContextMenu::PluginActionAt( |
1778 const gfx::Point& location, | 1774 const gfx::Point& location, |
1779 const WebPluginAction& action) { | 1775 const WebPluginAction& action) { |
1780 source_web_contents_->GetRenderViewHost()-> | 1776 source_web_contents_->GetRenderViewHost()-> |
1781 ExecutePluginActionAtLocation(location, action); | 1777 ExecutePluginActionAtLocation(location, action); |
1782 } | 1778 } |
OLD | NEW |