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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <set> | 10 #include <set> |
(...skipping 1611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 | 1622 |
1623 return false; | 1623 return false; |
1624 } | 1624 } |
1625 | 1625 |
1626 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { | 1626 void RenderViewContextMenu::ExecuteCommand(int id, int event_flags) { |
1627 RenderViewContextMenuBase::ExecuteCommand(id, event_flags); | 1627 RenderViewContextMenuBase::ExecuteCommand(id, event_flags); |
1628 if (command_executed_) | 1628 if (command_executed_) |
1629 return; | 1629 return; |
1630 command_executed_ = true; | 1630 command_executed_ = true; |
1631 | 1631 |
1632 RenderFrameHost* render_frame_host = GetRenderFrameHost(); | |
1633 | |
1634 // Process extension menu items. | 1632 // Process extension menu items. |
1635 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) { | 1633 if (ContextMenuMatcher::IsExtensionsCustomCommandId(id)) { |
1636 extension_items_.ExecuteCommand(id, source_web_contents_, params_); | 1634 extension_items_.ExecuteCommand(id, source_web_contents_, params_); |
1637 return; | 1635 return; |
1638 } | 1636 } |
1639 | 1637 |
1640 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && | 1638 if (id >= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_FIRST && |
1641 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { | 1639 id <= IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_LAST) { |
1642 ProtocolHandlerRegistry::ProtocolHandlerList handlers = | 1640 ProtocolHandlerRegistry::ProtocolHandlerList handlers = |
1643 GetHandlersForLinkUrl(); | 1641 GetHandlersForLinkUrl(); |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1889 DCHECK(platform_app->is_platform_app()); | 1887 DCHECK(platform_app->is_platform_app()); |
1890 | 1888 |
1891 apps::AppLoadService::Get(GetProfile()) | 1889 apps::AppLoadService::Get(GetProfile()) |
1892 ->RestartApplication(platform_app->id()); | 1890 ->RestartApplication(platform_app->id()); |
1893 break; | 1891 break; |
1894 } | 1892 } |
1895 | 1893 |
1896 case IDC_PRINT: { | 1894 case IDC_PRINT: { |
1897 #if defined(ENABLE_PRINTING) | 1895 #if defined(ENABLE_PRINTING) |
1898 if (params_.media_type != WebContextMenuData::MediaTypeNone) { | 1896 if (params_.media_type != WebContextMenuData::MediaTypeNone) { |
| 1897 RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
1899 if (render_frame_host) { | 1898 if (render_frame_host) { |
1900 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( | 1899 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( |
1901 render_frame_host->GetRoutingID())); | 1900 render_frame_host->GetRoutingID())); |
1902 } | 1901 } |
1903 break; | 1902 break; |
1904 } | 1903 } |
1905 | 1904 |
1906 printing::StartPrint( | 1905 printing::StartPrint( |
1907 source_web_contents_, | 1906 source_web_contents_, |
1908 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled), | 1907 GetPrefs(browser_context_)->GetBoolean(prefs::kPrintPreviewDisabled), |
1909 !params_.selection_text.empty()); | 1908 !params_.selection_text.empty()); |
1910 #endif // ENABLE_PRINTING | 1909 #endif // defined(ENABLE_PRINTING) |
1911 break; | 1910 break; |
1912 } | 1911 } |
1913 | 1912 |
1914 case IDC_ROUTE_MEDIA: { | 1913 case IDC_ROUTE_MEDIA: { |
1915 #if defined(ENABLE_MEDIA_ROUTER) | 1914 #if defined(ENABLE_MEDIA_ROUTER) |
1916 if (!media_router::MediaRouterEnabled(browser_context_)) | 1915 if (!media_router::MediaRouterEnabled(browser_context_)) |
1917 return; | 1916 return; |
1918 | 1917 |
1919 Browser* browser = | 1918 Browser* browser = |
1920 chrome::FindBrowserWithWebContents(source_web_contents_); | 1919 chrome::FindBrowserWithWebContents(source_web_contents_); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2184 source_web_contents_->GetRenderViewHost()-> | 2183 source_web_contents_->GetRenderViewHost()-> |
2185 ExecuteMediaPlayerActionAtLocation(location, action); | 2184 ExecuteMediaPlayerActionAtLocation(location, action); |
2186 } | 2185 } |
2187 | 2186 |
2188 void RenderViewContextMenu::PluginActionAt( | 2187 void RenderViewContextMenu::PluginActionAt( |
2189 const gfx::Point& location, | 2188 const gfx::Point& location, |
2190 const WebPluginAction& action) { | 2189 const WebPluginAction& action) { |
2191 source_web_contents_->GetRenderViewHost()-> | 2190 source_web_contents_->GetRenderViewHost()-> |
2192 ExecutePluginActionAtLocation(location, action); | 2191 ExecutePluginActionAtLocation(location, action); |
2193 } | 2192 } |
OLD | NEW |