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

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 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 680
681 void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) { 681 void BrowserActionsContainer::TestSetIconVisibilityCount(size_t icons) {
682 model_->SetVisibleIconCount(icons); 682 model_->SetVisibleIconCount(icons);
683 chevron_->SetVisible(icons < browser_action_views_.size()); 683 chevron_->SetVisible(icons < browser_action_views_.size());
684 container_width_ = IconCountToWidth(icons, chevron_->visible()); 684 container_width_ = IconCountToWidth(icons, chevron_->visible());
685 Layout(); 685 Layout();
686 SchedulePaint(); 686 SchedulePaint();
687 } 687 }
688 688
689 extensions::ExtensionKeybindingRegistry*
690 BrowserActionsContainer::GetExtensionKeybindingRegistry() {
691 return extension_keybinding_registry_.get();
692 }
693
689 void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) { 694 void BrowserActionsContainer::OnPaint(gfx::Canvas* canvas) {
690 // If the views haven't been initialized yet, wait for the next call to 695 // If the views haven't been initialized yet, wait for the next call to
691 // paint (one will be triggered by entering highlight mode). 696 // paint (one will be triggered by entering highlight mode).
692 if (model_->is_highlighting() && !browser_action_views_.empty()) { 697 if (model_->is_highlighting() && !browser_action_views_.empty()) {
693 views::Painter::PaintPainterAt( 698 views::Painter::PaintPainterAt(
694 canvas, highlight_painter_.get(), GetLocalBounds()); 699 canvas, highlight_painter_.get(), GetLocalBounds());
695 } 700 }
696 701
697 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while 702 // TODO(sky/glen): Instead of using a drop indicator, animate the icons while
698 // dragging (like we do for tab dragging). 703 // dragging (like we do for tab dragging).
(...skipping 375 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