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/command_service.h" |
9 #include "chrome/browser/extensions/api/commands/extension_command_service_facto
ry.h" | 9 #include "chrome/browser/extensions/api/commands/command_service_factory.h" |
10 #include "chrome/browser/extensions/extension_browser_event_router.h" | 10 #include "chrome/browser/extensions/extension_browser_event_router.h" |
11 #include "chrome/browser/extensions/extension_context_menu_model.h" | 11 #include "chrome/browser/extensions/extension_context_menu_model.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_tab_util.h" | 13 #include "chrome/browser/extensions/extension_tab_util.h" |
14 #include "chrome/browser/platform_util.h" | 14 #include "chrome/browser/platform_util.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 18 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 Extension::kPageActionIconMaxSize), | 58 Extension::kPageActionIconMaxSize), |
59 ImageLoadingTracker::DONT_CACHE); | 59 ImageLoadingTracker::DONT_CACHE); |
60 } | 60 } |
61 | 61 |
62 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 62 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
63 content::Source<Profile>( | 63 content::Source<Profile>( |
64 owner_->profile()->GetOriginalProfile())); | 64 owner_->profile()->GetOriginalProfile())); |
65 | 65 |
66 set_accessibility_focusable(true); | 66 set_accessibility_focusable(true); |
67 | 67 |
68 extensions::ExtensionCommandService* command_service = | 68 extensions::CommandService* command_service = |
69 extensions::ExtensionCommandServiceFactory::GetForProfile( | 69 extensions::CommandServiceFactory::GetForProfile( |
70 browser_->profile()); | 70 browser_->profile()); |
71 const extensions::Command* page_action_command = | 71 const extensions::Command* page_action_command = |
72 command_service->GetPageActionCommand( | 72 command_service->GetPageActionCommand( |
73 extension->id(), | 73 extension->id(), |
74 extensions::ExtensionCommandService::ACTIVE_ONLY); | 74 extensions::CommandService::ACTIVE_ONLY); |
75 if (page_action_command) { | 75 if (page_action_command) { |
76 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); | 76 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); |
77 owner_->GetFocusManager()->RegisterAccelerator( | 77 owner_->GetFocusManager()->RegisterAccelerator( |
78 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 78 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 PageActionImageView::~PageActionImageView() { | 82 PageActionImageView::~PageActionImageView() { |
83 if (keybinding_.get() && owner_->GetFocusManager()) | 83 if (keybinding_.get() && owner_->GetFocusManager()) |
84 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 84 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 const Extension* unloaded_extension = | 278 const Extension* unloaded_extension = |
279 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; | 279 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
280 if (page_action_ == unloaded_extension ->page_action()) | 280 if (page_action_ == unloaded_extension ->page_action()) |
281 owner_->UpdatePageActions(); | 281 owner_->UpdatePageActions(); |
282 } | 282 } |
283 | 283 |
284 void PageActionImageView::HidePopup() { | 284 void PageActionImageView::HidePopup() { |
285 if (popup_) | 285 if (popup_) |
286 popup_->GetWidget()->Close(); | 286 popup_->GetWidget()->Close(); |
287 } | 287 } |
OLD | NEW |