| 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 1703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1714 } | 1714 } |
| 1715 #else | 1715 #else |
| 1716 printing::PrintViewManagerBasic* print_view_manager = | 1716 printing::PrintViewManagerBasic* print_view_manager = |
| 1717 printing::PrintViewManagerBasic::FromWebContents( | 1717 printing::PrintViewManagerBasic::FromWebContents( |
| 1718 source_web_contents_); | 1718 source_web_contents_); |
| 1719 if (!print_view_manager) | 1719 if (!print_view_manager) |
| 1720 break; | 1720 break; |
| 1721 print_view_manager->PrintNow(); | 1721 print_view_manager->PrintNow(); |
| 1722 #endif // defined(ENABLE_FULL_PRINTING) | 1722 #endif // defined(ENABLE_FULL_PRINTING) |
| 1723 } else { | 1723 } else { |
| 1724 rvh->Send(new PrintMsg_PrintNodeUnderContextMenu(rvh->GetRoutingID())); | 1724 if (render_frame_host) { |
| 1725 render_frame_host->Send(new PrintMsg_PrintNodeUnderContextMenu( |
| 1726 render_frame_host->GetRoutingID())); |
| 1727 } |
| 1725 } | 1728 } |
| 1726 #endif // defined(ENABLE_PRINTING) | 1729 #endif // defined(ENABLE_PRINTING) |
| 1727 break; | 1730 break; |
| 1728 | 1731 |
| 1729 case IDC_VIEW_SOURCE: | 1732 case IDC_VIEW_SOURCE: |
| 1730 source_web_contents_->ViewSource(); | 1733 source_web_contents_->ViewSource(); |
| 1731 break; | 1734 break; |
| 1732 | 1735 |
| 1733 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: | 1736 case IDC_CONTENT_CONTEXT_INSPECTELEMENT: |
| 1734 Inspect(params_.x, params_.y); | 1737 Inspect(params_.x, params_.y); |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 content::Source<Profile>(Profile::FromBrowserContext( | 2027 content::Source<Profile>(Profile::FromBrowserContext( |
| 2025 source_web_contents_->GetBrowserContext())), | 2028 source_web_contents_->GetBrowserContext())), |
| 2026 content::Details<RetargetingDetails>(&details)); | 2029 content::Details<RetargetingDetails>(&details)); |
| 2027 } | 2030 } |
| 2028 | 2031 |
| 2029 void RenderViewContextMenu::CopyImageAt(int x, int y) { | 2032 void RenderViewContextMenu::CopyImageAt(int x, int y) { |
| 2030 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); | 2033 source_web_contents_->GetRenderViewHost()->CopyImageAt(x, y); |
| 2031 } | 2034 } |
| 2032 | 2035 |
| 2033 void RenderViewContextMenu::GetImageThumbnailForSearch() { | 2036 void RenderViewContextMenu::GetImageThumbnailForSearch() { |
| 2034 source_web_contents_->GetRenderViewHost()->Send( | 2037 RenderFrameHost* render_frame_host = |
| 2035 new ChromeViewMsg_RequestThumbnailForContextNode( | 2038 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 2036 source_web_contents_->GetRenderViewHost()->GetRoutingID(), | 2039 if (!render_frame_host) |
| 2037 kImageSearchThumbnailMinSize, | 2040 return; |
| 2038 gfx::Size(kImageSearchThumbnailMaxWidth, | 2041 render_frame_host->Send(new ChromeViewMsg_RequestThumbnailForContextNode( |
| 2039 kImageSearchThumbnailMaxHeight))); | 2042 render_frame_host->GetRoutingID(), |
| 2043 kImageSearchThumbnailMinSize, |
| 2044 gfx::Size(kImageSearchThumbnailMaxWidth, |
| 2045 kImageSearchThumbnailMaxHeight))); |
| 2040 } | 2046 } |
| 2041 | 2047 |
| 2042 void RenderViewContextMenu::Inspect(int x, int y) { | 2048 void RenderViewContextMenu::Inspect(int x, int y) { |
| 2043 content::RecordAction(UserMetricsAction("DevTools_InspectElement")); | 2049 content::RecordAction(UserMetricsAction("DevTools_InspectElement")); |
| 2044 RenderFrameHost* render_frame_host = | 2050 RenderFrameHost* render_frame_host = |
| 2045 RenderFrameHost::FromID(render_process_id_, render_frame_id_); | 2051 RenderFrameHost::FromID(render_process_id_, render_frame_id_); |
| 2046 if (!render_frame_host) | 2052 if (!render_frame_host) |
| 2047 return; | 2053 return; |
| 2048 DevToolsWindow::InspectElement(render_frame_host->GetRenderViewHost(), x, y); | 2054 DevToolsWindow::InspectElement(render_frame_host->GetRenderViewHost(), x, y); |
| 2049 } | 2055 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2061 source_web_contents_->GetRenderViewHost()-> | 2067 source_web_contents_->GetRenderViewHost()-> |
| 2062 ExecuteMediaPlayerActionAtLocation(location, action); | 2068 ExecuteMediaPlayerActionAtLocation(location, action); |
| 2063 } | 2069 } |
| 2064 | 2070 |
| 2065 void RenderViewContextMenu::PluginActionAt( | 2071 void RenderViewContextMenu::PluginActionAt( |
| 2066 const gfx::Point& location, | 2072 const gfx::Point& location, |
| 2067 const WebPluginAction& action) { | 2073 const WebPluginAction& action) { |
| 2068 source_web_contents_->GetRenderViewHost()-> | 2074 source_web_contents_->GetRenderViewHost()-> |
| 2069 ExecutePluginActionAtLocation(location, action); | 2075 ExecutePluginActionAtLocation(location, action); |
| 2070 } | 2076 } |
| OLD | NEW |