Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: chrome/browser/ui/views/toolbar/browser_actions_container.cc

Issue 553243002: Track the active ExtensionKeybindingRegistry and make it available to EventRewriter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkcr
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/toolbar/browser_actions_container.h" 5 #include "chrome/browser/ui/views/toolbar/browser_actions_container.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "chrome/browser/extensions/extension_action_manager.h" 9 #include "chrome/browser/extensions/extension_action_manager.h"
10 #include "chrome/browser/extensions/extension_util.h" 10 #include "chrome/browser/extensions/extension_util.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 void BrowserActionsContainer::ExecuteExtensionCommand( 262 void BrowserActionsContainer::ExecuteExtensionCommand(
263 const extensions::Extension* extension, 263 const extensions::Extension* extension,
264 const extensions::Command& command) { 264 const extensions::Command& command) {
265 // Global commands are handled by the ExtensionCommandsGlobalRegistry 265 // Global commands are handled by the ExtensionCommandsGlobalRegistry
266 // instance. 266 // instance.
267 DCHECK(!command.global()); 267 DCHECK(!command.global());
268 extension_keybinding_registry_->ExecuteCommand(extension->id(), 268 extension_keybinding_registry_->ExecuteCommand(extension->id(),
269 command.accelerator()); 269 command.accelerator());
270 } 270 }
271 271
272 bool BrowserActionsContainer::IsExtensionCommandRegistered(
273 const ui::Accelerator& accelerator) {
274 return extension_keybinding_registry_->IsAcceleratorRegistered(accelerator);
275 }
276
272 bool BrowserActionsContainer::ShownInsideMenu() const { 277 bool BrowserActionsContainer::ShownInsideMenu() const {
273 return in_overflow_mode(); 278 return in_overflow_mode();
274 } 279 }
275 280
276 void BrowserActionsContainer::OnBrowserActionViewDragDone() { 281 void BrowserActionsContainer::OnBrowserActionViewDragDone() {
277 // We notify here as well as in OnPerformDrop because the dragged view is 282 // We notify here as well as in OnPerformDrop because the dragged view is
278 // removed in OnPerformDrop, so it will never get its OnDragDone() call. 283 // removed in OnPerformDrop, so it will never get its OnDragDone() call.
279 // TODO(devlin): we should see about fixing that. 284 // TODO(devlin): we should see about fixing that.
280 FOR_EACH_OBSERVER(BrowserActionsContainerObserver, 285 FOR_EACH_OBSERVER(BrowserActionsContainerObserver,
281 observers_, 286 observers_,
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 size_t absolute_model_size = 1079 size_t absolute_model_size =
1075 model_size == -1 ? extensions.size() : model_size; 1080 model_size == -1 ? extensions.size() : model_size;
1076 1081
1077 // The main container will try to show |model_size| icons, but reduce if there 1082 // The main container will try to show |model_size| icons, but reduce if there
1078 // aren't enough displayable icons to do so. 1083 // aren't enough displayable icons to do so.
1079 size_t main_displayed = std::min(displayable_icon_count, absolute_model_size); 1084 size_t main_displayed = std::min(displayable_icon_count, absolute_model_size);
1080 // The overflow will display the extras, if any. 1085 // The overflow will display the extras, if any.
1081 return in_overflow_mode() ? 1086 return in_overflow_mode() ?
1082 displayable_icon_count - main_displayed : main_displayed; 1087 displayable_icon_count - main_displayed : main_displayed;
1083 } 1088 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698