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/extension_command_service.h" | 8 #include "chrome/browser/extensions/api/commands/extension_command_service.h" |
9 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" | 9 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" |
10 #include "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "chrome/common/extensions/extension_manifest_constants.h" | 22 #include "chrome/common/extensions/extension_manifest_constants.h" |
23 #include "chrome/common/extensions/extension_resource.h" | 23 #include "chrome/common/extensions/extension_resource.h" |
24 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
25 #include "content/public/browser/notification_source.h" | 25 #include "content/public/browser/notification_source.h" |
26 #include "ui/base/accessibility/accessible_view_state.h" | 26 #include "ui/base/accessibility/accessible_view_state.h" |
27 #include "ui/views/controls/menu/menu_item_view.h" | 27 #include "ui/views/controls/menu/menu_item_view.h" |
28 #include "ui/views/controls/menu/menu_model_adapter.h" | 28 #include "ui/views/controls/menu/menu_model_adapter.h" |
29 #include "ui/views/controls/menu/menu_runner.h" | 29 #include "ui/views/controls/menu/menu_runner.h" |
30 | 30 |
31 using content::WebContents; | 31 using content::WebContents; |
| 32 using extensions::Extension; |
32 | 33 |
33 PageActionImageView::PageActionImageView(LocationBarView* owner, | 34 PageActionImageView::PageActionImageView(LocationBarView* owner, |
34 ExtensionAction* page_action, | 35 ExtensionAction* page_action, |
35 Browser* browser) | 36 Browser* browser) |
36 : owner_(owner), | 37 : owner_(owner), |
37 page_action_(page_action), | 38 page_action_(page_action), |
38 browser_(browser), | 39 browser_(browser), |
39 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)), | 40 ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)), |
40 current_tab_id_(-1), | 41 current_tab_id_(-1), |
41 preview_enabled_(false), | 42 preview_enabled_(false), |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 DCHECK_EQ(popup_->GetWidget(), widget); | 266 DCHECK_EQ(popup_->GetWidget(), widget); |
266 popup_->GetWidget()->RemoveObserver(this); | 267 popup_->GetWidget()->RemoveObserver(this); |
267 popup_ = NULL; | 268 popup_ = NULL; |
268 } | 269 } |
269 | 270 |
270 void PageActionImageView::Observe(int type, | 271 void PageActionImageView::Observe(int type, |
271 const content::NotificationSource& source, | 272 const content::NotificationSource& source, |
272 const content::NotificationDetails& details) { | 273 const content::NotificationDetails& details) { |
273 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); | 274 DCHECK_EQ(chrome::NOTIFICATION_EXTENSION_UNLOADED, type); |
274 const Extension* unloaded_extension = | 275 const Extension* unloaded_extension = |
275 content::Details<UnloadedExtensionInfo>(details)->extension; | 276 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
276 if (page_action_ == unloaded_extension ->page_action()) | 277 if (page_action_ == unloaded_extension ->page_action()) |
277 owner_->UpdatePageActions(); | 278 owner_->UpdatePageActions(); |
278 } | 279 } |
279 | 280 |
280 void PageActionImageView::HidePopup() { | 281 void PageActionImageView::HidePopup() { |
281 if (popup_) | 282 if (popup_) |
282 popup_->GetWidget()->Close(); | 283 popup_->GetWidget()->Close(); |
283 } | 284 } |
OLD | NEW |