OLD | NEW |
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/ui/views/location_bar/page_action_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/api/commands/command_service.h" | 8 #include "chrome/browser/extensions/api/commands/command_service.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_icon_factory.h" | 10 #include "chrome/browser/extensions/extension_action_icon_factory.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 ExtensionPopup::ShowAction show_action) { | 86 ExtensionPopup::ShowAction show_action) { |
87 WebContents* web_contents = owner_->GetWebContents(); | 87 WebContents* web_contents = owner_->GetWebContents(); |
88 if (!web_contents) | 88 if (!web_contents) |
89 return; | 89 return; |
90 | 90 |
91 extensions::TabHelper* extensions_tab_helper = | 91 extensions::TabHelper* extensions_tab_helper = |
92 extensions::TabHelper::FromWebContents(web_contents); | 92 extensions::TabHelper::FromWebContents(web_contents); |
93 LocationBarController* controller = | 93 LocationBarController* controller = |
94 extensions_tab_helper->location_bar_controller(); | 94 extensions_tab_helper->location_bar_controller(); |
95 | 95 |
96 switch (controller->OnClicked(page_action_->extension_id(), 1)) { | 96 switch (controller->OnClicked(page_action_, |
| 97 LocationBarController::MOUSE_BUTTON_LEFT)) { |
97 case LocationBarController::ACTION_NONE: | 98 case LocationBarController::ACTION_NONE: |
98 break; | 99 break; |
99 | 100 |
100 case LocationBarController::ACTION_SHOW_POPUP: | 101 case LocationBarController::ACTION_SHOW_POPUP: |
101 ShowPopupWithURL(page_action_->GetPopupUrl(current_tab_id_), show_action); | 102 ShowPopupWithURL(page_action_->GetPopupUrl(current_tab_id_), show_action); |
102 break; | 103 break; |
103 | 104 |
104 case LocationBarController::ACTION_SHOW_CONTEXT_MENU: | 105 case LocationBarController::ACTION_SHOW_CONTEXT_MENU: |
105 // We are never passing OnClicked a right-click button, so assume that | 106 // We are never passing OnClicked a right-click button, so assume that |
106 // we're never going to be asked to show a context menu. | 107 // we're never going to be asked to show a context menu. |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 251 |
251 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, | 252 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow, |
252 show_action); | 253 show_action); |
253 popup_->GetWidget()->AddObserver(this); | 254 popup_->GetWidget()->AddObserver(this); |
254 } | 255 } |
255 | 256 |
256 void PageActionImageView::HidePopup() { | 257 void PageActionImageView::HidePopup() { |
257 if (popup_) | 258 if (popup_) |
258 popup_->GetWidget()->Close(); | 259 popup_->GetWidget()->Close(); |
259 } | 260 } |
OLD | NEW |