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 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 AppendAllExtensionItems(); | 718 AppendAllExtensionItems(); |
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 // Checking link should take precedence before checking selection since on Mac |
| 728 // right-clicking a link will also make it selected. |
| 729 if (params_.unfiltered_link_url.is_valid()) |
| 730 AppendLinkItems(); |
| 731 |
727 if (params_.is_editable) | 732 if (params_.is_editable) |
728 AppendEditableItems(); | 733 AppendEditableItems(); |
729 else if (has_selection) | 734 else if (has_selection) |
730 AppendCopyItem(); | 735 AppendCopyItem(); |
731 else if (params_.unfiltered_link_url.is_valid()) | |
732 AppendLinkItems(); | |
733 | 736 |
734 // Only add extension items from this extension. | 737 // Only add extension items from this extension. |
735 int index = 0; | 738 int index = 0; |
736 extension_items_.AppendExtensionItems(extension->id(), | 739 extension_items_.AppendExtensionItems(extension->id(), |
737 PrintableSelectionText(), &index); | 740 PrintableSelectionText(), &index); |
738 } | 741 } |
739 | 742 |
740 void RenderViewContextMenu::AddMenuItem(int command_id, | 743 void RenderViewContextMenu::AddMenuItem(int command_id, |
741 const string16& title) { | 744 const string16& title) { |
742 menu_model_.AddItem(command_id, title); | 745 menu_model_.AddItem(command_id, title); |
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2044 source_web_contents_->GetRenderViewHost()-> | 2047 source_web_contents_->GetRenderViewHost()-> |
2045 ExecuteMediaPlayerActionAtLocation(location, action); | 2048 ExecuteMediaPlayerActionAtLocation(location, action); |
2046 } | 2049 } |
2047 | 2050 |
2048 void RenderViewContextMenu::PluginActionAt( | 2051 void RenderViewContextMenu::PluginActionAt( |
2049 const gfx::Point& location, | 2052 const gfx::Point& location, |
2050 const WebPluginAction& action) { | 2053 const WebPluginAction& action) { |
2051 source_web_contents_->GetRenderViewHost()-> | 2054 source_web_contents_->GetRenderViewHost()-> |
2052 ExecutePluginActionAtLocation(location, action); | 2055 ExecutePluginActionAtLocation(location, action); |
2053 } | 2056 } |
OLD | NEW |