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

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

Issue 553233002: Dynamically calculate the number of extension icons to show per row in overflow (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/icons_per_menu_row/icons_per_overflow_menu_row 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 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 6 #define CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
7 7
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "chrome/browser/extensions/extension_keybinding_registry.h" 9 #include "chrome/browser/extensions/extension_keybinding_registry.h"
10 #include "chrome/browser/extensions/extension_toolbar_model.h" 10 #include "chrome/browser/extensions/extension_toolbar_model.h"
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 virtual extensions::ActiveTabPermissionGranter* 241 virtual extensions::ActiveTabPermissionGranter*
242 GetActiveTabPermissionGranter() OVERRIDE; 242 GetActiveTabPermissionGranter() OVERRIDE;
243 243
244 // Retrieve the current popup. This should only be used by unit tests. 244 // Retrieve the current popup. This should only be used by unit tests.
245 ExtensionPopup* TestGetPopup(); 245 ExtensionPopup* TestGetPopup();
246 246
247 // Set how many icons the container should show. This should only be used by 247 // Set how many icons the container should show. This should only be used by
248 // unit tests. 248 // unit tests.
249 void TestSetIconVisibilityCount(size_t icons); 249 void TestSetIconVisibilityCount(size_t icons);
250 250
251 // Returns the width of an icon, optionally with its padding.
252 static int IconWidth(bool include_padding);
253
254 // Returns the height of an icon.
255 static int IconHeight();
256
257 // The maximum number of icons to show per row when in overflow mode (showing
258 // icons in the application menu).
259 // This is set by the active menu before display.
260 static int icons_per_overflow_menu_row;
sky 2014/09/11 19:42:27 style guide says no public members.
Devlin 2014/09/11 20:32:13 Done.
261
262 // Horizontal spacing between most items in the container, as well as after
263 // the last item or chevron (if visible).
264 static const int kItemSpacing;
sky 2014/09/11 19:42:27 nit: constants should be first in the section (see
Devlin 2014/09/11 20:32:13 Done.
265
251 // During testing we can disable animations by setting this flag to true, 266 // During testing we can disable animations by setting this flag to true,
252 // so that the bar resizes instantly, instead of having to poll it while it 267 // so that the bar resizes instantly, instead of having to poll it while it
253 // animates to open/closed status. 268 // animates to open/closed status.
254 static bool disable_animations_during_testing_; 269 static bool disable_animations_during_testing_;
255 270
256 protected: 271 protected:
257 // Overridden from views::View: 272 // Overridden from views::View:
258 virtual void ViewHierarchyChanged( 273 virtual void ViewHierarchyChanged(
259 const ViewHierarchyChangedDetails& details) OVERRIDE; 274 const ViewHierarchyChangedDetails& details) OVERRIDE;
260 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE; 275 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
261 virtual void OnThemeChanged() OVERRIDE; 276 virtual void OnThemeChanged() OVERRIDE;
262 277
263 private: 278 private:
264 friend class BrowserActionView; // So it can access IconWidth().
265
266 // A struct representing the position at which an action will be dropped. 279 // A struct representing the position at which an action will be dropped.
267 struct DropPosition; 280 struct DropPosition;
268 281
269 typedef std::vector<BrowserActionView*> BrowserActionViews; 282 typedef std::vector<BrowserActionView*> BrowserActionViews;
270 283
271 // Returns the width of an icon, optionally with its padding.
272 static int IconWidth(bool include_padding);
273
274 // Returns the height of an icon.
275 static int IconHeight();
276 284
277 // extensions::ExtensionToolbarModel::Observer implementation. 285 // extensions::ExtensionToolbarModel::Observer implementation.
278 virtual void ToolbarExtensionAdded(const extensions::Extension* extension, 286 virtual void ToolbarExtensionAdded(const extensions::Extension* extension,
279 int index) OVERRIDE; 287 int index) OVERRIDE;
280 virtual void ToolbarExtensionRemoved( 288 virtual void ToolbarExtensionRemoved(
281 const extensions::Extension* extension) OVERRIDE; 289 const extensions::Extension* extension) OVERRIDE;
282 virtual void ToolbarExtensionMoved(const extensions::Extension* extension, 290 virtual void ToolbarExtensionMoved(const extensions::Extension* extension,
283 int index) OVERRIDE; 291 int index) OVERRIDE;
284 virtual void ToolbarExtensionUpdated( 292 virtual void ToolbarExtensionUpdated(
285 const extensions::Extension* extension) OVERRIDE; 293 const extensions::Extension* extension) OVERRIDE;
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 425
418 // Handles delayed showing of the overflow menu when hovering. 426 // Handles delayed showing of the overflow menu when hovering.
419 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_; 427 base::WeakPtrFactory<BrowserActionsContainer> show_menu_task_factory_;
420 428
421 ObserverList<BrowserActionsContainerObserver> observers_; 429 ObserverList<BrowserActionsContainerObserver> observers_;
422 430
423 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 431 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
424 }; 432 };
425 433
426 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 434 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698