| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 gfx::Size(Extension::kBrowserActionIconMaxSize, | 109 gfx::Size(Extension::kBrowserActionIconMaxSize, |
| 110 Extension::kBrowserActionIconMaxSize), | 110 Extension::kBrowserActionIconMaxSize), |
| 111 ImageLoadingTracker::DONT_CACHE); | 111 ImageLoadingTracker::DONT_CACHE); |
| 112 } else { | 112 } else { |
| 113 // Set the icon to be the default extensions icon. | 113 // Set the icon to be the default extensions icon. |
| 114 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 114 default_icon_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
| 115 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); | 115 IDR_EXTENSIONS_FAVICON).ToSkBitmap(); |
| 116 UpdateState(); | 116 UpdateState(); |
| 117 } | 117 } |
| 118 | 118 |
| 119 // Iterate through all the keybindings and see if one is assigned to the | 119 const Extension::ExtensionKeybinding* browser_action_command = |
| 120 // browserAction. | 120 extension_->browser_action_command(); |
| 121 const std::vector<Extension::ExtensionKeybinding>& commands = | 121 if (browser_action_command) { |
| 122 extension_->keybindings(); | 122 keybinding_.reset(new ui::Accelerator( |
| 123 for (size_t i = 0; i < commands.size(); ++i) { | 123 browser_action_command->accelerator())); |
| 124 if (commands[i].command_name() == | 124 panel_->GetFocusManager()->RegisterAccelerator( |
| 125 extension_manifest_values::kBrowserActionKeybindingEvent) { | 125 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); |
| 126 keybinding_.reset(new ui::Accelerator(commands[i].accelerator())); | |
| 127 panel_->GetFocusManager()->RegisterAccelerator( | |
| 128 *keybinding_.get(), ui::AcceleratorManager::kHighPriority, this); | |
| 129 break; | |
| 130 } | |
| 131 } | 126 } |
| 132 } | 127 } |
| 133 | 128 |
| 134 MenuButton::ViewHierarchyChanged(is_add, parent, child); | 129 MenuButton::ViewHierarchyChanged(is_add, parent, child); |
| 135 } | 130 } |
| 136 | 131 |
| 137 void BrowserActionButton::ButtonPressed(views::Button* sender, | 132 void BrowserActionButton::ButtonPressed(views::Button* sender, |
| 138 const views::Event& event) { | 133 const views::Event& event) { |
| 139 panel_->OnBrowserActionExecuted(this, false); | 134 panel_->OnBrowserActionExecuted(this, false); |
| 140 } | 135 } |
| (...skipping 989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1130 } | 1125 } |
| 1131 } | 1126 } |
| 1132 | 1127 |
| 1133 bool BrowserActionsContainer::ShouldDisplayBrowserAction( | 1128 bool BrowserActionsContainer::ShouldDisplayBrowserAction( |
| 1134 const Extension* extension) { | 1129 const Extension* extension) { |
| 1135 // Only display incognito-enabled extensions while in incognito mode. | 1130 // Only display incognito-enabled extensions while in incognito mode. |
| 1136 return | 1131 return |
| 1137 (!profile_->IsOffTheRecord() || | 1132 (!profile_->IsOffTheRecord() || |
| 1138 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); | 1133 profile_->GetExtensionService()->IsIncognitoEnabled(extension->id())); |
| 1139 } | 1134 } |
| OLD | NEW |