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

Side by Side Diff: chrome/browser/views/location_bar_view.cc

Issue 486022: Implement context menu for page and browser actions (Closed) Base URL: svn://chrome-svn/chrome/trunk/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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome_browser.gypi » ('j') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 void LocationBarView::PageActionImageView::OnMouseMoved( 1372 void LocationBarView::PageActionImageView::OnMouseMoved(
1373 const views::MouseEvent& event) { 1373 const views::MouseEvent& event) {
1374 // PageActionImageView uses normal tooltips rather than the info bubble, 1374 // PageActionImageView uses normal tooltips rather than the info bubble,
1375 // so just do nothing here rather than letting LocationBarImageView start 1375 // so just do nothing here rather than letting LocationBarImageView start
1376 // its hover timer. 1376 // its hover timer.
1377 } 1377 }
1378 1378
1379 bool LocationBarView::PageActionImageView::OnMousePressed( 1379 bool LocationBarView::PageActionImageView::OnMousePressed(
1380 const views::MouseEvent& event) { 1380 const views::MouseEvent& event) {
1381 int button = -1; 1381 int button = -1;
1382 if (event.IsLeftMouseButton()) 1382 if (event.IsLeftMouseButton()) {
1383 button = 1; 1383 button = 1;
1384 else if (event.IsMiddleMouseButton()) 1384 } else if (event.IsMiddleMouseButton()) {
1385 button = 2; 1385 button = 2;
1386 else if (event.IsRightMouseButton()) 1386 } else if (event.IsRightMouseButton()) {
1387 button = 3; 1387 // Get the top left point of this button in screen coordinates.
1388 gfx::Point point = gfx::Point(0,0);
1389 ConvertPointToScreen(this, &point);
1390
1391 // Make the menu appear below the button.
1392 point.Offset(0, height());
1393
1394 Extension* extension = profile_->GetExtensionsService()->GetExtensionById(
1395 page_action()->extension_id(), false);
1396
1397 if (!context_menu_.get())
1398 context_menu_.reset(new ExtensionActionContextMenu());
1399 context_menu_->Run(extension, point);
1400 return false;
1401 }
1388 1402
1389 ExecuteAction(button); 1403 ExecuteAction(button);
1390 return true; 1404 return true;
1391 } 1405 }
1392 1406
1393 void LocationBarView::PageActionImageView::ShowInfoBubble() { 1407 void LocationBarView::PageActionImageView::ShowInfoBubble() {
1394 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); 1408 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT));
1395 } 1409 }
1396 1410
1397 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image, 1411 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1607 const int button = 1; // Left mouse button. 1621 const int button = 1; // Left mouse button.
1608 page_action_views_[i]->image_view()->ExecuteAction(button); 1622 page_action_views_[i]->image_view()->ExecuteAction(button);
1609 return; 1623 return;
1610 } 1624 }
1611 ++current; 1625 ++current;
1612 } 1626 }
1613 } 1627 }
1614 } 1628 }
1615 NOTREACHED(); 1629 NOTREACHED();
1616 } 1630 }
OLDNEW
« no previous file with comments | « chrome/browser/views/location_bar_view.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698