| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 10 matching lines...) Expand all Loading... |
| 21 #include "chrome/browser/bubble_positioner.h" | 21 #include "chrome/browser/bubble_positioner.h" |
| 22 #include "chrome/browser/command_updater.h" | 22 #include "chrome/browser/command_updater.h" |
| 23 #include "chrome/browser/content_setting_bubble_model.h" | 23 #include "chrome/browser/content_setting_bubble_model.h" |
| 24 #include "chrome/browser/content_setting_image_model.h" | 24 #include "chrome/browser/content_setting_image_model.h" |
| 25 #include "chrome/browser/extensions/extension_browser_event_router.h" | 25 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 26 #include "chrome/browser/extensions/extensions_service.h" | 26 #include "chrome/browser/extensions/extensions_service.h" |
| 27 #include "chrome/browser/profile.h" | 27 #include "chrome/browser/profile.h" |
| 28 #include "chrome/browser/search_engines/template_url_model.h" | 28 #include "chrome/browser/search_engines/template_url_model.h" |
| 29 #include "chrome/browser/view_ids.h" | 29 #include "chrome/browser/view_ids.h" |
| 30 #include "chrome/browser/views/extensions/extension_popup.h" | 30 #include "chrome/browser/views/extensions/extension_popup.h" |
| 31 #include "chrome/browser/views/frame/browser_view.h" |
| 31 #include "chrome/browser/views/content_blocked_bubble_contents.h" | 32 #include "chrome/browser/views/content_blocked_bubble_contents.h" |
| 32 #include "chrome/common/content_settings.h" | 33 #include "chrome/common/content_settings.h" |
| 33 #include "chrome/common/pref_names.h" | 34 #include "chrome/common/pref_names.h" |
| 34 #include "grit/generated_resources.h" | 35 #include "grit/generated_resources.h" |
| 35 #include "grit/theme_resources.h" | 36 #include "grit/theme_resources.h" |
| 36 #include "net/base/net_util.h" | 37 #include "net/base/net_util.h" |
| 37 | 38 |
| 38 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 39 #include "chrome/browser/views/first_run_bubble.h" | 40 #include "chrome/browser/views/first_run_bubble.h" |
| 40 #endif | 41 #endif |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1535 } else if (event.IsRightMouseButton()) { | 1536 } else if (event.IsRightMouseButton()) { |
| 1536 // Get the top left point of this button in screen coordinates. | 1537 // Get the top left point of this button in screen coordinates. |
| 1537 gfx::Point point = gfx::Point(0, 0); | 1538 gfx::Point point = gfx::Point(0, 0); |
| 1538 ConvertPointToScreen(this, &point); | 1539 ConvertPointToScreen(this, &point); |
| 1539 | 1540 |
| 1540 // Make the menu appear below the button. | 1541 // Make the menu appear below the button. |
| 1541 point.Offset(0, height()); | 1542 point.Offset(0, height()); |
| 1542 | 1543 |
| 1543 Extension* extension = profile_->GetExtensionsService()->GetExtensionById( | 1544 Extension* extension = profile_->GetExtensionsService()->GetExtensionById( |
| 1544 page_action()->extension_id(), false); | 1545 page_action()->extension_id(), false); |
| 1545 | 1546 Browser* browser = BrowserView::GetBrowserViewForNativeWindow( |
| 1546 if (!context_menu_.get()) | 1547 ::GetAncestor(GetWidget()->GetNativeView(), GA_ROOT))->browser(); |
| 1547 context_menu_.reset(new ExtensionActionContextMenu()); | 1548 context_menu_contents_.reset(new ExtensionContextMenuModel( |
| 1548 context_menu_->Run(extension, | 1549 extension, browser, this)); |
| 1549 extension->page_action(), | 1550 context_menu_menu_.reset(new views::Menu2(context_menu_contents_.get())); |
| 1550 this, // ExtensionActionContextMenuModel::Delegate | 1551 context_menu_menu_->RunContextMenuAt(point); |
| 1551 profile_->GetPrefs(), | |
| 1552 point); | |
| 1553 return; | 1552 return; |
| 1554 } | 1553 } |
| 1555 | 1554 |
| 1556 ExecuteAction(button, false); // inspect_with_devtools | 1555 ExecuteAction(button, false); // inspect_with_devtools |
| 1557 } | 1556 } |
| 1558 | 1557 |
| 1559 void LocationBarView::PageActionImageView::ShowInfoBubble() { | 1558 void LocationBarView::PageActionImageView::ShowInfoBubble() { |
| 1560 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); | 1559 ShowInfoBubbleImpl(ASCIIToWide(tooltip_), GetColor(false, TEXT)); |
| 1561 } | 1560 } |
| 1562 | 1561 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 icon = iter->second; | 1623 icon = iter->second; |
| 1625 } | 1624 } |
| 1626 } | 1625 } |
| 1627 | 1626 |
| 1628 if (!icon.isNull()) | 1627 if (!icon.isNull()) |
| 1629 SetImage(&icon); | 1628 SetImage(&icon); |
| 1630 } | 1629 } |
| 1631 SetVisible(visible); | 1630 SetVisible(visible); |
| 1632 } | 1631 } |
| 1633 | 1632 |
| 1634 void LocationBarView::PageActionImageView::ShowPopupForDevToolsWindow( | 1633 void LocationBarView::PageActionImageView::InspectPopup( |
| 1635 Extension* extension, ExtensionAction* extension_action) { | 1634 ExtensionAction* action) { |
| 1636 ExecuteAction(1, // left-click | 1635 ExecuteAction(1, // left-click |
| 1637 true); // inspect_with_devtools | 1636 true); // inspect_with_devtools |
| 1638 } | 1637 } |
| 1639 | 1638 |
| 1640 void LocationBarView::PageActionImageView::ExtensionPopupClosed( | 1639 void LocationBarView::PageActionImageView::ExtensionPopupClosed( |
| 1641 ExtensionPopup* popup) { | 1640 ExtensionPopup* popup) { |
| 1642 DCHECK_EQ(popup_, popup); | 1641 DCHECK_EQ(popup_, popup); |
| 1643 // ExtensionPopup is ref-counted, so we don't need to delete it. | 1642 // ExtensionPopup is ref-counted, so we don't need to delete it. |
| 1644 popup_ = NULL; | 1643 popup_ = NULL; |
| 1645 } | 1644 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1738 page_action_views_[i]->image_view()->ExecuteAction(kLeftMouseButton, | 1737 page_action_views_[i]->image_view()->ExecuteAction(kLeftMouseButton, |
| 1739 false); // inspect_with_devtools | 1738 false); // inspect_with_devtools |
| 1740 return; | 1739 return; |
| 1741 } | 1740 } |
| 1742 ++current; | 1741 ++current; |
| 1743 } | 1742 } |
| 1744 } | 1743 } |
| 1745 | 1744 |
| 1746 NOTREACHED(); | 1745 NOTREACHED(); |
| 1747 } | 1746 } |
| OLD | NEW |