| 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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 } // namespace | 310 } // namespace |
| 311 | 311 |
| 312 // static | 312 // static |
| 313 gfx::Vector2d RenderViewContextMenu::GetOffset( | 313 gfx::Vector2d RenderViewContextMenu::GetOffset( |
| 314 RenderFrameHost* render_frame_host) { | 314 RenderFrameHost* render_frame_host) { |
| 315 gfx::Vector2d offset; | 315 gfx::Vector2d offset; |
| 316 #if defined(ENABLE_EXTENSIONS) | 316 #if defined(ENABLE_EXTENSIONS) |
| 317 WebContents* web_contents = | 317 WebContents* web_contents = |
| 318 WebContents::FromRenderFrameHost(render_frame_host); | 318 WebContents::FromRenderFrameHost(render_frame_host); |
| 319 WebContents* top_level_web_contents = | 319 WebContents* top_level_web_contents = |
| 320 extensions::GuestViewBase::GetTopLevelWebContents(web_contents); | 320 guest_view::GuestViewBase::GetTopLevelWebContents(web_contents); |
| 321 if (web_contents && top_level_web_contents && | 321 if (web_contents && top_level_web_contents && |
| 322 web_contents != top_level_web_contents) { | 322 web_contents != top_level_web_contents) { |
| 323 gfx::Rect bounds = web_contents->GetContainerBounds(); | 323 gfx::Rect bounds = web_contents->GetContainerBounds(); |
| 324 gfx::Rect top_level_bounds = top_level_web_contents->GetContainerBounds(); | 324 gfx::Rect top_level_bounds = top_level_web_contents->GetContainerBounds(); |
| 325 offset = bounds.origin() - top_level_bounds.origin(); | 325 offset = bounds.origin() - top_level_bounds.origin(); |
| 326 } | 326 } |
| 327 #endif // defined(ENABLE_EXTENSIONS) | 327 #endif // defined(ENABLE_EXTENSIONS) |
| 328 return offset; | 328 return offset; |
| 329 } | 329 } |
| 330 | 330 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 IDS_CONTENT_CONTEXT_MUTE); | 790 IDS_CONTENT_CONTEXT_MUTE); |
| 791 | 791 |
| 792 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, | 792 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, |
| 793 IDS_CONTENT_CONTEXT_LOOP); | 793 IDS_CONTENT_CONTEXT_LOOP); |
| 794 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, | 794 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, |
| 795 IDS_CONTENT_CONTEXT_CONTROLS); | 795 IDS_CONTENT_CONTEXT_CONTROLS); |
| 796 } | 796 } |
| 797 | 797 |
| 798 void RenderViewContextMenu::AppendPluginItems() { | 798 void RenderViewContextMenu::AppendPluginItems() { |
| 799 if (params_.page_url == params_.src_url || | 799 if (params_.page_url == params_.src_url || |
| 800 extensions::GuestViewBase::IsGuest(source_web_contents_)) { | 800 guest_view::GuestViewBase::IsGuest(source_web_contents_)) { |
| 801 // Full page plugin, so show page menu items. | 801 // Full page plugin, so show page menu items. |
| 802 if (params_.link_url.is_empty() && params_.selection_text.empty()) | 802 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
| 803 AppendPageItems(); | 803 AppendPageItems(); |
| 804 } else { | 804 } else { |
| 805 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, | 805 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, |
| 806 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 806 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
| 807 // The "Print" menu item should always be included for plugins. If | 807 // The "Print" menu item should always be included for plugins. If |
| 808 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) | 808 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) |
| 809 // is true the item will be added inside AppendPrintItem(). Otherwise we | 809 // is true the item will be added inside AppendPrintItem(). Otherwise we |
| 810 // add "Print" here. | 810 // add "Print" here. |
| (...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 source_web_contents_->GetRenderViewHost()-> | 1837 source_web_contents_->GetRenderViewHost()-> |
| 1838 ExecuteMediaPlayerActionAtLocation(location, action); | 1838 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1839 } | 1839 } |
| 1840 | 1840 |
| 1841 void RenderViewContextMenu::PluginActionAt( | 1841 void RenderViewContextMenu::PluginActionAt( |
| 1842 const gfx::Point& location, | 1842 const gfx::Point& location, |
| 1843 const WebPluginAction& action) { | 1843 const WebPluginAction& action) { |
| 1844 source_web_contents_->GetRenderViewHost()-> | 1844 source_web_contents_->GetRenderViewHost()-> |
| 1845 ExecutePluginActionAtLocation(location, action); | 1845 ExecutePluginActionAtLocation(location, action); |
| 1846 } | 1846 } |
| OLD | NEW |