Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 17440004: Fix the problem that wrong context menu shows up when right clicking a link on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698