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_.page_url == params_.src_url) { | 765 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
766 // Full page plugin, so show page menu items. | 766 AppendPageItems(); |
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 } | |
raymes
2015/02/16 00:58:41
I had more of a think about this and I think the c
| |
779 } | 767 } |
780 | 768 |
781 void RenderViewContextMenu::AppendPageItems() { | 769 void RenderViewContextMenu::AppendPageItems() { |
782 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); | 770 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); |
783 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); | 771 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); |
784 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); | 772 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); |
785 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 773 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
786 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, | 774 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, |
787 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 775 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
788 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); | 776 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); |
(...skipping 991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1780 void RenderViewContextMenu::MediaPlayerActionAt( | 1768 void RenderViewContextMenu::MediaPlayerActionAt( |
1781 const gfx::Point& location, | 1769 const gfx::Point& location, |
1782 const WebMediaPlayerAction& action) { | 1770 const WebMediaPlayerAction& action) { |
1783 source_web_contents_->GetRenderViewHost()-> | 1771 source_web_contents_->GetRenderViewHost()-> |
1784 ExecuteMediaPlayerActionAtLocation(location, action); | 1772 ExecuteMediaPlayerActionAtLocation(location, action); |
1785 } | 1773 } |
1786 | 1774 |
1787 void RenderViewContextMenu::PluginActionAt( | 1775 void RenderViewContextMenu::PluginActionAt( |
1788 const gfx::Point& location, | 1776 const gfx::Point& location, |
1789 const WebPluginAction& action) { | 1777 const WebPluginAction& action) { |
1790 source_web_contents_->GetRenderViewHost()-> | 1778 RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
1791 ExecutePluginActionAtLocation(location, action); | 1779 if (!render_frame_host) |
1780 return; | |
1781 WebContents::FromRenderFrameHost(render_frame_host)->GetRenderViewHost() | |
1782 ->ExecutePluginActionAtLocation(location, action); | |
1792 } | 1783 } |
OLD | NEW |