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" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 gfx::Size(Extension::kBrowserActionIconMaxSize, | 126 gfx::Size(Extension::kBrowserActionIconMaxSize, |
127 Extension::kBrowserActionIconMaxSize), | 127 Extension::kBrowserActionIconMaxSize), |
128 ImageLoadingTracker::DONT_CACHE); | 128 ImageLoadingTracker::DONT_CACHE); |
129 } else { | 129 } else { |
130 // Set the icon to be the default extensions icon. | 130 // Set the icon to be the default extensions icon. |
131 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 131 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
132 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); | 132 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); |
133 UpdateState(); | 133 UpdateState(); |
134 } | 134 } |
135 | 135 |
136 ExtensionCommandService* command_service = | 136 extensions::ExtensionCommandService* command_service = |
137 ExtensionCommandServiceFactory::GetForProfile( | 137 extensions::ExtensionCommandServiceFactory::GetForProfile( |
138 panel_->browser()->profile()); | 138 panel_->browser()->profile()); |
139 const extensions::Command* browser_action_command = | 139 const extensions::Command* browser_action_command = |
140 command_service->GetActiveBrowserActionCommand(extension_->id()); | 140 command_service->GetBrowserActionCommand( |
| 141 extension_->id(), |
| 142 extensions::ExtensionCommandService::ACTIVE_ONLY); |
141 if (browser_action_command) { | 143 if (browser_action_command) { |
142 keybinding_.reset(new ui::Accelerator( | 144 keybinding_.reset(new ui::Accelerator( |
143 browser_action_command->accelerator())); | 145 browser_action_command->accelerator())); |
144 panel_->GetFocusManager()->RegisterAccelerator( | 146 panel_->GetFocusManager()->RegisterAccelerator( |
145 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | 147 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
146 } | 148 } |
147 } | 149 } |
148 | 150 |
149 MenuButton::ViewHierarchyChanged(is_add, parent, child); | 151 MenuButton::ViewHierarchyChanged(is_add, parent, child); |
150 } | 152 } |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1133 } | 1135 } |
1134 } | 1136 } |
1135 | 1137 |
1136 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1138 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
1137 const Extension* extension) { | 1139 const Extension* extension) { |
1138 // Only display incognito-enabled extensions while in incognito mode. | 1140 // Only display incognito-enabled extensions while in incognito mode. |
1139 return | 1141 return |
1140 (!profile_->IsOffTheRecord() || | 1142 (!profile_->IsOffTheRecord() || |
1141 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1143 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
1142 } | 1144 } |
OLD | NEW |