| 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/extension_browser_event_router.h" | 8 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 9 #include "chrome/browser/extensions/extension_context_menu_model.h" | 9 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 10 #include "chrome/browser/extensions/extension_keybinding_registry.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
| 11 #include "chrome/browser/extensions/extension_tab_util.h" | 12 #include "chrome/browser/extensions/extension_tab_util.h" |
| 12 #include "chrome/browser/platform_util.h" | 13 #include "chrome/browser/platform_util.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser_list.h" | 15 #include "chrome/browser/ui/browser_list.h" |
| 15 #include "chrome/browser/ui/views/frame/browser_view.h" | 16 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 16 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 17 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 18 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/extensions/extension.h" | 19 #include "chrome/common/extensions/extension.h" |
| 19 #include "chrome/common/extensions/extension_action.h" | 20 #include "chrome/common/extensions/extension_action.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ImageLoadingTracker::DONT_CACHE); | 57 ImageLoadingTracker::DONT_CACHE); |
| 57 } | 58 } |
| 58 | 59 |
| 59 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, | 60 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, |
| 60 content::Source<Profile>( | 61 content::Source<Profile>( |
| 61 owner_->profile()->GetOriginalProfile())); | 62 owner_->profile()->GetOriginalProfile())); |
| 62 | 63 |
| 63 set_accessibility_focusable(true); | 64 set_accessibility_focusable(true); |
| 64 | 65 |
| 65 const Extension::ExtensionKeybinding* page_action_command = | 66 const Extension::ExtensionKeybinding* page_action_command = |
| 66 extension->page_action_command(); | 67 ExtensionKeybindingRegistry::GetActivePageActionCommand( |
| 68 browser_->profile(), extension->id()); |
| 67 if (page_action_command) { | 69 if (page_action_command) { |
| 68 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); | 70 keybinding_.reset(new ui::Accelerator(page_action_command->accelerator())); |
| 69 owner_->GetFocusManager()->RegisterAccelerator( | 71 owner_->GetFocusManager()->RegisterAccelerator( |
| 70 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 72 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
| 71 } | 73 } |
| 72 } | 74 } |
| 73 | 75 |
| 74 PageActionImageView::~PageActionImageView() { | 76 PageActionImageView::~PageActionImageView() { |
| 75 if (keybinding_.get() && owner_->GetFocusManager()) | 77 if (keybinding_.get() && owner_->GetFocusManager()) |
| 76 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); | 78 owner_->GetFocusManager()->UnregisterAccelerator(*keybinding_.get(), this); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 const Extension* unloaded_extension = | 272 const Extension* unloaded_extension = |
| 271 content::Details<UnloadedExtensionInfo>(details)->extension; | 273 content::Details<UnloadedExtensionInfo>(details)->extension; |
| 272 if (page_action_ == unloaded_extension ->page_action()) | 274 if (page_action_ == unloaded_extension ->page_action()) |
| 273 owner_->UpdatePageActions(); | 275 owner_->UpdatePageActions(); |
| 274 } | 276 } |
| 275 | 277 |
| 276 void PageActionImageView::HidePopup() { | 278 void PageActionImageView::HidePopup() { |
| 277 if (popup_) | 279 if (popup_) |
| 278 popup_->GetWidget()->Close(); | 280 popup_->GetWidget()->Close(); |
| 279 } | 281 } |
| OLD | NEW |