OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
719 AppendDeveloperItems(); | 719 AppendDeveloperItems(); |
720 } | 720 } |
721 | 721 |
722 void RenderViewContextMenu::AppendPanelItems() { | 722 void RenderViewContextMenu::AppendPanelItems() { |
723 const Extension* extension = GetExtension(); | 723 const Extension* extension = GetExtension(); |
724 | 724 |
725 bool has_selection = !params_.selection_text.empty(); | 725 bool has_selection = !params_.selection_text.empty(); |
726 | 726 |
727 if (params_.is_editable) | 727 if (params_.is_editable) |
728 AppendEditableItems(); | 728 AppendEditableItems(); |
729 // Checking link should take precedence before checking selection since on Mac | |
730 // right-clicking a link will also make it selected. | |
731 else if (params_.unfiltered_link_url.is_valid()) | |
732 AppendLinkItems(); | |
729 else if (has_selection) | 733 else if (has_selection) |
Dmitry Titov
2013/06/19 01:14:41
why have an 'else' here? On normal pages we show b
jianli
2013/06/19 17:08:18
Changed to allow both link and copy.
| |
730 AppendCopyItem(); | 734 AppendCopyItem(); |
731 else if (params_.unfiltered_link_url.is_valid()) | |
732 AppendLinkItems(); | |
733 | 735 |
734 // Only add extension items from this extension. | 736 // Only add extension items from this extension. |
735 int index = 0; | 737 int index = 0; |
736 extension_items_.AppendExtensionItems(extension->id(), | 738 extension_items_.AppendExtensionItems(extension->id(), |
737 PrintableSelectionText(), &index); | 739 PrintableSelectionText(), &index); |
738 } | 740 } |
739 | 741 |
740 void RenderViewContextMenu::AddMenuItem(int command_id, | 742 void RenderViewContextMenu::AddMenuItem(int command_id, |
741 const string16& title) { | 743 const string16& title) { |
742 menu_model_.AddItem(command_id, title); | 744 menu_model_.AddItem(command_id, title); |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2044 source_web_contents_->GetRenderViewHost()-> | 2046 source_web_contents_->GetRenderViewHost()-> |
2045 ExecuteMediaPlayerActionAtLocation(location, action); | 2047 ExecuteMediaPlayerActionAtLocation(location, action); |
2046 } | 2048 } |
2047 | 2049 |
2048 void RenderViewContextMenu::PluginActionAt( | 2050 void RenderViewContextMenu::PluginActionAt( |
2049 const gfx::Point& location, | 2051 const gfx::Point& location, |
2050 const WebPluginAction& action) { | 2052 const WebPluginAction& action) { |
2051 source_web_contents_->GetRenderViewHost()-> | 2053 source_web_contents_->GetRenderViewHost()-> |
2052 ExecutePluginActionAtLocation(location, action); | 2054 ExecutePluginActionAtLocation(location, action); |
2053 } | 2055 } |
OLD | NEW |