Chromium Code Reviews| 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 // Full page plugin, so show page menu items. |
|
raymes
2015/02/13 00:40:27
Please remove this comment as it's inaccurate now.
Deepak
2015/02/13 04:31:49
Done.
| |
| 766 // Full page plugin, so show page menu items. | 766 if (params_.link_url.is_empty() && params_.selection_text.empty()) |
| 767 if (params_.link_url.is_empty() && params_.selection_text.empty()) | 767 AppendPageItems(); |
| 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 } | |
| 779 } | 768 } |
| 780 | 769 |
| 781 void RenderViewContextMenu::AppendPageItems() { | 770 void RenderViewContextMenu::AppendPageItems() { |
| 782 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); | 771 menu_model_.AddItemWithStringId(IDC_BACK, IDS_CONTENT_CONTEXT_BACK); |
| 783 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); | 772 menu_model_.AddItemWithStringId(IDC_FORWARD, IDS_CONTENT_CONTEXT_FORWARD); |
| 784 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); | 773 menu_model_.AddItemWithStringId(IDC_RELOAD, IDS_CONTENT_CONTEXT_RELOAD); |
| 785 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); | 774 menu_model_.AddSeparator(ui::NORMAL_SEPARATOR); |
| 786 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, | 775 menu_model_.AddItemWithStringId(IDC_SAVE_PAGE, |
| 787 IDS_CONTENT_CONTEXT_SAVEPAGEAS); | 776 IDS_CONTENT_CONTEXT_SAVEPAGEAS); |
| 788 menu_model_.AddItemWithStringId(IDC_PRINT, IDS_CONTENT_CONTEXT_PRINT); | 777 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( | 1769 void RenderViewContextMenu::MediaPlayerActionAt( |
| 1781 const gfx::Point& location, | 1770 const gfx::Point& location, |
| 1782 const WebMediaPlayerAction& action) { | 1771 const WebMediaPlayerAction& action) { |
| 1783 source_web_contents_->GetRenderViewHost()-> | 1772 source_web_contents_->GetRenderViewHost()-> |
| 1784 ExecuteMediaPlayerActionAtLocation(location, action); | 1773 ExecuteMediaPlayerActionAtLocation(location, action); |
| 1785 } | 1774 } |
| 1786 | 1775 |
| 1787 void RenderViewContextMenu::PluginActionAt( | 1776 void RenderViewContextMenu::PluginActionAt( |
| 1788 const gfx::Point& location, | 1777 const gfx::Point& location, |
| 1789 const WebPluginAction& action) { | 1778 const WebPluginAction& action) { |
| 1790 source_web_contents_->GetRenderViewHost()-> | 1779 RenderFrameHost* render_frame_host = GetRenderFrameHost(); |
| 1791 ExecutePluginActionAtLocation(location, action); | 1780 if (!render_frame_host) |
| 1781 return; | |
| 1782 WebContents::FromRenderFrameHost(render_frame_host)->GetRenderViewHost() | |
| 1783 ->ExecutePluginActionAtLocation(location, action); | |
| 1792 } | 1784 } |
| OLD | NEW |