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 47 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 ExtensionCommandService* command_service = | 68 extensions::ExtensionCommandService* command_service = |
69 ExtensionCommandServiceFactory::GetForProfile(browser_->profile()); | 69 extensions::ExtensionCommandServiceFactory::GetForProfile( |
| 70 browser_->profile()); |
70 const extensions::Command* page_action_command = | 71 const extensions::Command* page_action_command = |
71 command_service->GetActivePageActionCommand(extension->id()); | 72 command_service->GetPageActionCommand( |
| 73 extension->id(), |
| 74 extensions::ExtensionCommandService::ACTIVE_ONLY); |
72 if (page_action_command) { | 75 if (page_action_command) { |
73 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); | 76 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); |
74 owner_->GetFocusManager()->RegisterAccelerator( | 77 owner_->GetFocusManager()->RegisterAccelerator( |
75 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 78 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
76 } | 79 } |
77 } | 80 } |
78 | 81 |
79 PageActionImageView::~PageActionImageView() { | 82 PageActionImageView::~PageActionImageView() { |
80 if (keybinding_.get() && owner_->GetFocusManager()) | 83 if (keybinding_.get() && owner_->GetFocusManager()) |
81 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... |
275 const Extension* unloaded_extension = | 278 const Extension* unloaded_extension = |
276 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; | 279 content::Details<extensions::UnloadedExtensionInfo>(details)->extension; |
277 if (page_action_ == unloaded_extension ->page_action()) | 280 if (page_action_ == unloaded_extension ->page_action()) |
278 owner_->UpdatePageActions(); | 281 owner_->UpdatePageActions(); |
279 } | 282 } |
280 | 283 |
281 void PageActionImageView::HidePopup() { | 284 void PageActionImageView::HidePopup() { |
282 if (popup_) | 285 if (popup_) |
283 popup_->GetWidget()->Close(); | 286 popup_->GetWidget()->Close(); |
284 } | 287 } |
OLD | NEW |