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/utf_string_conversions.h" | 7 #include "base/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/api/commands/command_service_factory.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
10 #include "chrome/browser/extensions/extension_context_menu_model.h" | 10 #include "chrome/browser/extensions/extension_context_menu_model.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 21 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
22 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h" | 22 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h" |
23 #include "chrome/common/chrome_notification_types.h" | 23 #include "chrome/common/chrome_notification_types.h" |
24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/extensions/extension_action.h" | 25 #include "chrome/common/extensions/extension_action.h" |
26 #include "chrome/common/extensions/extension_manifest_constants.h" | 26 #include "chrome/common/extensions/extension_manifest_constants.h" |
27 #include "chrome/common/extensions/extension_resource.h" | 27 #include "chrome/common/extensions/extension_resource.h" |
28 #include "content/public/browser/notification_details.h" | 28 #include "content/public/browser/notification_details.h" |
29 #include "content/public/browser/notification_source.h" | 29 #include "content/public/browser/notification_source.h" |
30 #include "ui/base/accessibility/accessible_view_state.h" | 30 #include "ui/base/accessibility/accessible_view_state.h" |
| 31 #include "ui/base/event.h" |
31 #include "ui/views/controls/menu/menu_item_view.h" | 32 #include "ui/views/controls/menu/menu_item_view.h" |
32 #include "ui/views/controls/menu/menu_model_adapter.h" | 33 #include "ui/views/controls/menu/menu_model_adapter.h" |
33 #include "ui/views/controls/menu/menu_runner.h" | 34 #include "ui/views/controls/menu/menu_runner.h" |
34 | 35 |
35 using content::WebContents; | 36 using content::WebContents; |
36 using extensions::LocationBarController; | 37 using extensions::LocationBarController; |
37 using extensions::Extension; | 38 using extensions::Extension; |
38 | 39 |
39 PageActionImageView::PageActionImageView(LocationBarView* owner, | 40 PageActionImageView::PageActionImageView(LocationBarView* owner, |
40 ExtensionAction* page_action, | 41 ExtensionAction* page_action, |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 button = 2; | 180 button = 2; |
180 } else if (event.IsRightMouseButton()) { | 181 } else if (event.IsRightMouseButton()) { |
181 // Don't show a menu here, its handled in View::ProcessMouseReleased. We | 182 // Don't show a menu here, its handled in View::ProcessMouseReleased. We |
182 // show the context menu by way of being the ContextMenuController. | 183 // show the context menu by way of being the ContextMenuController. |
183 return; | 184 return; |
184 } | 185 } |
185 | 186 |
186 ExecuteAction(button); | 187 ExecuteAction(button); |
187 } | 188 } |
188 | 189 |
189 bool PageActionImageView::OnKeyPressed(const views::KeyEvent& event) { | 190 bool PageActionImageView::OnKeyPressed(const ui::KeyEvent& event) { |
190 if (event.key_code() == ui::VKEY_SPACE || | 191 if (event.key_code() == ui::VKEY_SPACE || |
191 event.key_code() == ui::VKEY_RETURN) { | 192 event.key_code() == ui::VKEY_RETURN) { |
192 ExecuteAction(1); | 193 ExecuteAction(1); |
193 return true; | 194 return true; |
194 } | 195 } |
195 return false; | 196 return false; |
196 } | 197 } |
197 | 198 |
198 void PageActionImageView::OnImageLoaded(const gfx::Image& image, | 199 void PageActionImageView::OnImageLoaded(const gfx::Image& image, |
199 const std::string& extension_id, | 200 const std::string& extension_id, |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; | 315 views::BubbleBorder::TOP_LEFT : views::BubbleBorder::TOP_RIGHT; |
315 | 316 |
316 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); | 317 popup_ = ExtensionPopup::ShowPopup(popup_url, browser_, this, arrow_location); |
317 popup_->GetWidget()->AddObserver(this); | 318 popup_->GetWidget()->AddObserver(this); |
318 } | 319 } |
319 | 320 |
320 void PageActionImageView::HidePopup() { | 321 void PageActionImageView::HidePopup() { |
321 if (popup_) | 322 if (popup_) |
322 popup_->GetWidget()->Close(); | 323 popup_->GetWidget()->Close(); |
323 } | 324 } |
OLD | NEW |