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 { | |
1500 if (render_frame_host) { | 1484 if (render_frame_host) { |
1501 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( | 1485 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( |
1502 render_frame_host->GetRoutingID())); | 1486 render_frame_host->GetRoutingID())); |
1503 } | 1487 } |
| 1488 break; |
1504 } | 1489 } |
1505 #endif // defined(ENABLE_PRINTING) | 1490 |
| 1491 #if defined(ENABLE_FULL_PRINTING) |
| 1492 printing::PrintViewManager* print_view_manager = |
| 1493 printing::PrintViewManager::FromWebContents(source_web_contents_); |
| 1494 if (!print_view_manager) |
| 1495 break; |
| 1496 if (!GetPrefs(browser_context_) |
| 1497 ->GetBoolean(prefs::kPrintPreviewDisabled)) { |
| 1498 print_view_manager->PrintPreviewNow(!params_.selection_text.empty()); |
| 1499 break; |
| 1500 } |
| 1501 #else // ENABLE_FULL_PRINTING |
| 1502 printing::PrintViewManagerBasic* print_view_manager = |
| 1503 printing::PrintViewManagerBasic::FromWebContents( |
| 1504 source_web_contents_); |
| 1505 if (!print_view_manager) |
| 1506 break; |
| 1507 #endif // ENABLE_FULL_PRINTING |
| 1508 |
| 1509 #if !defined(DISABLE_BASIC_PRINTING) |
| 1510 print_view_manager->PrintNow(); |
| 1511 #endif // !DISABLE_BASIC_PRINTING |
| 1512 |
| 1513 #endif // ENABLE_PRINTING |
1506 break; | 1514 break; |
| 1515 } |
1507 | 1516 |
1508 case IDC_VIEW_SOURCE: | 1517 case IDC_VIEW_SOURCE: |
1509 source_web_contents_->ViewSource(); | 1518 source_web_contents_->ViewSource(); |
1510 break; | 1519 break; |
1511 | 1520 |
1512 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | 1521 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: |
1513 Inspect(params_.x, params_.y); | 1522 Inspect(params_.x, params_.y); |
1514 break; | 1523 break; |
1515 | 1524 |
1516 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: { | 1525 case IDC_CONTENT_CONTEXT_INSPECTBACKGROUNDPAGE: { |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 source_web_contents_->GetRenderViewHost()-> | 1778 source_web_contents_->GetRenderViewHost()-> |
1770 ExecuteMediaPlayerActionAtLocation(location, action); | 1779 ExecuteMediaPlayerActionAtLocation(location, action); |
1771 } | 1780 } |
1772 | 1781 |
1773 void RenderViewContextMenu::PluginActionAt( | 1782 void RenderViewContextMenu::PluginActionAt( |
1774 const gfx::Point& location, | 1783 const gfx::Point& location, |
1775 const WebPluginAction& action) { | 1784 const WebPluginAction& action) { |
1776 source_web_contents_->GetRenderViewHost()-> | 1785 source_web_contents_->GetRenderViewHost()-> |
1777 ExecutePluginActionAtLocation(location, action); | 1786 ExecutePluginActionAtLocation(location, action); |
1778 } | 1787 } |
OLD | NEW |