| 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/browser_actions_container.h" | 5 #include "chrome/browser/ui/views/browser_actions_container.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/extensions/extension_browser_event_router.h" | 11 #include "chrome/browser/extensions/extension_browser_event_router.h" |
| 12 #include "chrome/browser/extensions/extension_command_service.h" |
| 13 #include "chrome/browser/extensions/extension_command_service_factory.h" |
| 12 #include "chrome/browser/extensions/extension_context_menu_model.h" | 14 #include "chrome/browser/extensions/extension_context_menu_model.h" |
| 13 #include "chrome/browser/extensions/extension_host.h" | 15 #include "chrome/browser/extensions/extension_host.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 16 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_tabs_module.h" | 17 #include "chrome/browser/extensions/extension_tabs_module.h" |
| 16 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/sessions/restore_tab_helper.h" | 20 #include "chrome/browser/sessions/restore_tab_helper.h" |
| 19 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
| 20 #include "chrome/browser/ui/browser_window.h" | 22 #include "chrome/browser/ui/browser_window.h" |
| 21 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 23 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 gfx::Size(Extension::kBrowserActionIconMaxSize, | 113 gfx::Size(Extension::kBrowserActionIconMaxSize, |
| 112 Extension::kBrowserActionIconMaxSize), | 114 Extension::kBrowserActionIconMaxSize), |
| 113 ImageLoadingTracker::DONT_CACHE); | 115 ImageLoadingTracker::DONT_CACHE); |
| 114 } else { | 116 } else { |
| 115 // Set the icon to be the default extensions icon. | 117 // Set the icon to be the default extensions icon. |
| 116 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 118 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 117 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); | 119 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); |
| 118 UpdateState(); | 120 UpdateState(); |
| 119 } | 121 } |
| 120 | 122 |
| 123 ExtensionCommandService* command_service = |
| 124 ExtensionCommandServiceFactory::GetForProfile( |
| 125 panel_->browser()->profile()); |
| 121 const Extension::ExtensionKeybinding* browser_action_command = | 126 const Extension::ExtensionKeybinding* browser_action_command = |
| 122 extension_->browser_action_command(); | 127 command_service->GetActiveBrowserActionCommand(extension_->id()); |
| 123 if (browser_action_command) { | 128 if (browser_action_command) { |
| 124 keybinding_.reset(new ui::Accelerator( | 129 keybinding_.reset(new ui::Accelerator( |
| 125 browser_action_command->accelerator())); | 130 browser_action_command->accelerator())); |
| 126 panel_->GetFocusManager()->RegisterAccelerator( | 131 panel_->GetFocusManager()->RegisterAccelerator( |
| 127 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 132 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
| 128 } | 133 } |
| 129 } | 134 } |
| 130 | 135 |
| 131 MenuButton::ViewHierarchyChanged(is_add, parent, child); | 136 MenuButton::ViewHierarchyChanged(is_add, parent, child); |
| 132 } | 137 } |
| (...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 } | 1125 } |
| 1121 } | 1126 } |
| 1122 | 1127 |
| 1123 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1128 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1124 const Extension* extension) { | 1129 const Extension* extension) { |
| 1125 // Only display incognito-enabled extensions while in incognito mode. | 1130 // Only display incognito-enabled extensions while in incognito mode. |
| 1126 return | 1131 return |
| 1127 (!profile_->IsOffTheRecord() || | 1132 (!profile_->IsOffTheRecord() || |
| 1128 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1133 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 1129 } | 1134 } |
| OLD | NEW |