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

Unified Diff: chrome/browser/views/location_bar_view.cc

Issue 501136: Merge 34812 - Add the rightclick context menu for Browser actions and Page... (Closed) Base URL: svn://chrome-svn/chrome/branches/249/src/
Patch Set: Created 11 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/location_bar_view.cc
===================================================================
--- chrome/browser/views/location_bar_view.cc (revision 35008)
+++ chrome/browser/views/location_bar_view.cc (working copy)
@@ -1373,13 +1373,27 @@
bool LocationBarView::PageActionImageView::OnMousePressed(
const views::MouseEvent& event) {
int button = -1;
- if (event.IsLeftMouseButton())
+ if (event.IsLeftMouseButton()) {
button = 1;
- else if (event.IsMiddleMouseButton())
+ } else if (event.IsMiddleMouseButton()) {
button = 2;
- else if (event.IsRightMouseButton())
- button = 3;
+ } else if (event.IsRightMouseButton()) {
+ // Get the top left point of this button in screen coordinates.
+ gfx::Point point = gfx::Point(0,0);
+ ConvertPointToScreen(this, &point);
+ // Make the menu appear below the button.
+ point.Offset(0, height());
+
+ Extension* extension = profile_->GetExtensionsService()->GetExtensionById(
+ page_action()->extension_id(), false);
+
+ if (!context_menu_.get())
+ context_menu_.reset(new ExtensionActionContextMenu());
+ context_menu_->Run(extension, point);
+ return false;
+ }
+
ExecuteAction(button);
return true;
}
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698