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

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

Issue 602613003: Fix three small bugs in BrowserActionsContainer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 void OnBrowserActionVisibilityChanged(); 300 void OnBrowserActionVisibilityChanged();
301 301
302 // Returns the preferred width of the container in order to show all icons 302 // Returns the preferred width of the container in order to show all icons
303 // that should be visible and, optionally, the chevron. 303 // that should be visible and, optionally, the chevron.
304 int GetPreferredWidth(); 304 int GetPreferredWidth();
305 305
306 // Sets the chevron to be visible or not based on whether all browser actions 306 // Sets the chevron to be visible or not based on whether all browser actions
307 // are displayed. 307 // are displayed.
308 void SetChevronVisibility(); 308 void SetChevronVisibility();
309 309
310 // Given a number of |icons| and whether to |display_chevron|, returns the 310 // Given a number of |icons|, returns the pixels needed to draw the entire
311 // amount of pixels needed to draw the entire container. For convenience, 311 // container (including the chevron if the number of icons is not all the
312 // callers can set |icons| to -1 to mean "all icons". 312 // icons and we're not using the redesign). For convenience, callers can set
Peter Kasting 2014/10/02 21:49:56 These two edited comments appear to be the only re
Devlin 2014/10/02 22:11:06 Good point. Done.
313 int IconCountToWidth(int icons, bool display_chevron) const; 313 // |icons| to -1 to mean "all icons".
314 int IconCountToWidth(int icons) const;
314 315
315 // Given a pixel width, returns the number of icons that fit. (This 316 // Given a pixel width, returns the number of icons that fit. (This
316 // automatically determines whether a chevron will be needed and includes it 317 // automatically determines whether a chevron will be needed and includes it
317 // in the calculation.) 318 // in the calculation.)
318 size_t WidthToIconCount(int pixels) const; 319 size_t WidthToIconCount(int pixels) const;
319 320
320 // Returns the absolute minimum size you can shrink the container down to and 321 // Returns the absolute minimum size you can shrink the container down to and
321 // still show it. This assumes a visible chevron because the only way we 322 // still show it. In the redesign, this leaves only enough room for the resize
323 // area; otherwise, this assumes a visible chevron because the only way we
322 // would not have a chevron when shrinking down this far is if there were no 324 // would not have a chevron when shrinking down this far is if there were no
323 // icons, in which case the container wouldn't be shown at all. 325 // icons, in which case the container wouldn't be shown at all.
324 int MinimumNonemptyWidth() const; 326 int MinimumNonemptyWidth() const;
325 327
326 // Animate to the target size (unless testing, in which case we go straight to 328 // Animate to the target size (unless testing, in which case we go straight to
327 // the target size). 329 // the target size).
328 void Animate(gfx::Tween::Type type, size_t num_visible_icons); 330 void Animate(gfx::Tween::Type type, size_t num_visible_icons);
329 331
330 // Returns true if this extension should be shown in this toolbar. This can 332 // Returns true if this extension should be shown in this toolbar. This can
331 // return false if we are in an incognito window and the extension is disabled 333 // return false if we are in an incognito window and the extension is disabled
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 ObserverList<BrowserActionsContainerObserver> observers_; 408 ObserverList<BrowserActionsContainerObserver> observers_;
407 409
408 // The maximum number of icons to show per row when in overflow mode (showing 410 // The maximum number of icons to show per row when in overflow mode (showing
409 // icons in the application menu). 411 // icons in the application menu).
410 static int icons_per_overflow_menu_row_; 412 static int icons_per_overflow_menu_row_;
411 413
412 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); 414 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer);
413 }; 415 };
414 416
415 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ 417 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698