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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 61 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
62 content::Source<Profile>( | 62 content::Source<Profile>( |
63 owner_->profile()->GetOriginalProfile())); | 63 owner_->profile()->GetOriginalProfile())); |
64 | 64 |
65 set_accessibility_focusable(true); | 65 set_accessibility_focusable(true); |
66 | 66 |
67 ExtensionCommandService* command_service = | 67 ExtensionCommandService* command_service = |
68 ExtensionCommandServiceFactory::GetForProfile(browser_->profile()); | 68 ExtensionCommandServiceFactory::GetForProfile(browser_->profile()); |
69 const extensions::Command* page_action_command = | 69 const extensions::Command* page_action_command = |
70 command_service->GetActivePageActionCommand(extension->id()); | 70 command_service->GetPageActionCommand( |
| 71 extension->id(), ExtensionCommandService::ACTIVE_ONLY); |
71 if (page_action_command) { | 72 if (page_action_command) { |
72 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); | 73 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); |
73 owner_->GetFocusManager()->RegisterAccelerator( | 74 owner_->GetFocusManager()->RegisterAccelerator( |
74 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 75 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
75 } | 76 } |
76 } | 77 } |
77 | 78 |
78 PageActionImageView::~PageActionImageView() { | 79 PageActionImageView::~PageActionImageView() { |
79 if (keybinding_.get() && owner_->GetFocusManager()) | 80 if (keybinding_.get() && owner_->GetFocusManager()) |
80 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 81 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 const Extension* unloaded_extension = | 275 const Extension* unloaded_extension = |
275 content::Details<UnloadedExtensionInfo>(details)->extension; | 276 content::Details<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 |