OLD | NEW |
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 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 void LocationBarView::PageActionImageView::OnMouseMoved( | 1366 void LocationBarView::PageActionImageView::OnMouseMoved( |
1367 const views::MouseEvent& event) { | 1367 const views::MouseEvent& event) { |
1368 // PageActionImageView uses normal tooltips rather than the info bubble, | 1368 // PageActionImageView uses normal tooltips rather than the info bubble, |
1369 // so just do nothing here rather than letting LocationBarImageView start | 1369 // so just do nothing here rather than letting LocationBarImageView start |
1370 // its hover timer. | 1370 // its hover timer. |
1371 } | 1371 } |
1372 | 1372 |
1373 bool LocationBarView::PageActionImageView::OnMousePressed( | 1373 bool LocationBarView::PageActionImageView::OnMousePressed( |
1374 const views::MouseEvent& event) { | 1374 const views::MouseEvent& event) { |
1375 int button = -1; | 1375 int button = -1; |
1376 if (event.IsLeftMouseButton()) | 1376 if (event.IsLeftMouseButton()) { |
1377 button = 1; | 1377 button = 1; |
1378 else if (event.IsMiddleMouseButton()) | 1378 } else if (event.IsMiddleMouseButton()) { |
1379 button = 2; | 1379 button = 2; |
1380 else if (event.IsRightMouseButton()) | 1380 } else if (event.IsRightMouseButton()) { |
1381 button = 3; | 1381 // Get the top left point of this button in screen coordinates. |
| 1382 gfx::Point point = gfx::Point(0,0); |
| 1383 ConvertPointToScreen(this, &point); |
| 1384 |
| 1385 // Make the menu appear below the button. |
| 1386 point.Offset(0, height()); |
| 1387 |
| 1388 Extension* extension = profile_->GetExtensionsService()->GetExtensionById( |
| 1389 page_action()->extension_id(), false); |
| 1390 |
| 1391 if (!context_menu_.get()) |
| 1392 context_menu_.reset(new ExtensionActionContextMenu()); |
| 1393 context_menu_->Run(extension, point); |
| 1394 return false; |
| 1395 } |
1382 | 1396 |
1383 ExecuteAction(button); | 1397 ExecuteAction(button); |
1384 return true; | 1398 return true; |
1385 } | 1399 } |
1386 | 1400 |
1387 void LocationBarView::PageActionImageView::ShowInfoBubble() { | 1401 void LocationBarView::PageActionImageView::ShowInfoBubble() { |
1388 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); | 1402 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); |
1389 } | 1403 } |
1390 | 1404 |
1391 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image, | 1405 void LocationBarView::PageActionImageView::OnImageLoaded(SkBitmap* image, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 const int button = 1; // Left mouse button. | 1614 const int button = 1; // Left mouse button. |
1601 page_action_views_[i]->image_view()->ExecuteAction(button); | 1615 page_action_views_[i]->image_view()->ExecuteAction(button); |
1602 return; | 1616 return; |
1603 } | 1617 } |
1604 ++current; | 1618 ++current; |
1605 } | 1619 } |
1606 } | 1620 } |
1607 } | 1621 } |
1608 NOTREACHED(); | 1622 NOTREACHED(); |
1609 } | 1623 } |
OLD | NEW |