OLD | NEW |
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 Loading... |
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 // icons and there's not a separate overflow container). For convenience, |
312 // callers can set |icons| to -1 to mean "all icons". | 313 // callers can set |icons| to -1 to mean "all icons". |
313 int IconCountToWidth(int icons, bool display_chevron) const; | 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. If there's no chevron (i.e., there's a separate overflow |
322 // would not have a chevron when shrinking down this far is if there were no | 323 // container), this leaves only enough room for the resize area; otherwise, |
323 // icons, in which case the container wouldn't be shown at all. | 324 // this assumes a visible chevron because the only way we would not have a |
| 325 // chevron when shrinking down this far is if there were no icons, in which |
| 326 // case the container wouldn't be shown at all. |
324 int MinimumNonemptyWidth() const; | 327 int MinimumNonemptyWidth() const; |
325 | 328 |
326 // Animate to the target size (unless testing, in which case we go straight to | 329 // Animate to the target size (unless testing, in which case we go straight to |
327 // the target size). | 330 // the target size). |
328 void Animate(gfx::Tween::Type type, size_t num_visible_icons); | 331 void Animate(gfx::Tween::Type type, size_t num_visible_icons); |
329 | 332 |
330 // Returns true if this extension should be shown in this toolbar. This can | 333 // 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 | 334 // return false if we are in an incognito window and the extension is disabled |
332 // for incognito. | 335 // for incognito. |
333 bool ShouldDisplayBrowserAction(const extensions::Extension* extension) const; | 336 bool ShouldDisplayBrowserAction(const extensions::Extension* extension) const; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 ObserverList<BrowserActionsContainerObserver> observers_; | 409 ObserverList<BrowserActionsContainerObserver> observers_; |
407 | 410 |
408 // The maximum number of icons to show per row when in overflow mode (showing | 411 // The maximum number of icons to show per row when in overflow mode (showing |
409 // icons in the application menu). | 412 // icons in the application menu). |
410 static int icons_per_overflow_menu_row_; | 413 static int icons_per_overflow_menu_row_; |
411 | 414 |
412 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 415 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
413 }; | 416 }; |
414 | 417 |
415 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 418 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
OLD | NEW |