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 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 IDS_CONTENT_CONTEXT_UNMUTE : | 755 IDS_CONTENT_CONTEXT_UNMUTE : |
756 IDS_CONTENT_CONTEXT_MUTE); | 756 IDS_CONTENT_CONTEXT_MUTE); |
757 | 757 |
758 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, | 758 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_LOOP, |
759 IDS_CONTENT_CONTEXT_LOOP); | 759 IDS_CONTENT_CONTEXT_LOOP); |
760 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, | 760 menu_model_.AddCheckItemWithStringId(IDC_CONTENT_CONTEXT_CONTROLS, |
761 IDS_CONTENT_CONTEXT_CONTROLS); | 761 IDS_CONTENT_CONTEXT_CONTROLS); |
762 } | 762 } |
763 | 763 |
764 void RenderViewContextMenu::AppendPluginItems() { | 764 void RenderViewContextMenu::AppendPluginItems() { |
765 if (params_.link_url.is_empty() && params_.selection_text.empty()) | 765 if (params_.page_url == params_.src_url) { |
766 AppendPageItems(); | 766 // Full page plugin, so show page menu items. |
| 767 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
| 768 AppendPageItems(); |
| 769 } else { |
| 770 menu_model_.AddItemWithStringId(IDC_CONTENT_CONTEXT_SAVEAVAS, |
| 771 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
| 772 // The "Print" menu item should always be included for plugins. If |
| 773 // content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT) |
| 774 // is true the item will be added inside AppendPrintItem(). Otherwise we |
| 775 // add "Print" here. |
| 776 if (!content_type_->SupportsGroup(ContextMenuContentType::ITEM_GROUP_PRINT)) |
| 777 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); |
| 778 } |
767 } | 779 } |
768 | 780 |
769 void RenderViewContextMenu::AppendPageItems() { | 781 void RenderViewContextMenu::AppendPageItems() { |
770 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); | 782 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); |
771 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); | 783 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); |
772 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); | 784 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); |
773 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 785 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
774 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, | 786 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, |
775 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 787 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
776 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); | 788 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1768 void RenderViewContextMenu::MediaPlayerActionAt( | 1780 void RenderViewContextMenu::MediaPlayerActionAt( |
1769 const gfx::Point& location, | 1781 const gfx::Point& location, |
1770 const WebMediaPlayerAction& action) { | 1782 const WebMediaPlayerAction& action) { |
1771 source_web_contents_->GetRenderViewHost()-> | 1783 source_web_contents_->GetRenderViewHost()-> |
1772 ExecuteMediaPlayerActionAtLocation(location, action); | 1784 ExecuteMediaPlayerActionAtLocation(location, action); |
1773 } | 1785 } |
1774 | 1786 |
1775 void RenderViewContextMenu::PluginActionAt( | 1787 void RenderViewContextMenu::PluginActionAt( |
1776 const gfx::Point& location, | 1788 const gfx::Point& location, |
1777 const WebPluginAction& action) { | 1789 const WebPluginAction& action) { |
1778 RenderFrameHost* render_frame_host = GetRenderFrameHost(); | 1790 source_web_contents_->GetRenderViewHost()-> |
1779 if (!render_frame_host) | 1791 ExecutePluginActionAtLocation(location, action); |
1780 return; | |
1781 WebContents::FromRenderFrameHost(render_frame_host)->GetRenderViewHost() | |
1782 ->ExecutePluginActionAtLocation(location, action); | |
1783 } | 1792 } |
OLD | NEW |