| 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/ui/toolbar/toolbar_actions_bar.h" | 10 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // toolbar does not) and as such does not have an overflow itself. The overflow | 45 // toolbar does not) and as such does not have an overflow itself. The overflow |
| 46 // container also does not support resizing. Since the main container only shows | 46 // container also does not support resizing. Since the main container only shows |
| 47 // icons in the Chrome toolbar, it is limited to a single row of icons. The | 47 // icons in the Chrome toolbar, it is limited to a single row of icons. The |
| 48 // overflow container, however, is allowed to display icons in multiple rows. | 48 // overflow container, however, is allowed to display icons in multiple rows. |
| 49 // | 49 // |
| 50 // The main container is placed flush against the omnibox and hot dog menu, | 50 // The main container is placed flush against the omnibox and hot dog menu, |
| 51 // whereas the overflow container is placed within the hot dog menu. The | 51 // whereas the overflow container is placed within the hot dog menu. The |
| 52 // layout is similar to this: | 52 // layout is similar to this: |
| 53 // rI_I_IcCs | 53 // rI_I_IcCs |
| 54 // Where the letters are as follows: | 54 // Where the letters are as follows: |
| 55 // r: An invisible resize area. This is ToolbarView::kStandardSpacing pixels | 55 // r: An invisible resize area. This is |
| 56 // wide and directly adjacent to the omnibox. Only shown for the main | 56 // GetLayoutConstant(TOOLBAR_STANDARD_SPACING) pixels wide and directly |
| 57 // container. | 57 // adjacent to the omnibox. Only shown for the main container. |
| 58 // I: An icon. This is as wide as the IDR_BROWSER_ACTION image. | 58 // I: An icon. In material design this has a width of 28. Otherwise it is as |
| 59 // _: kItemSpacing pixels of empty space. | 59 // wide as the IDR_BROWSER_ACTION image. |
| 60 // c: kChevronSpacing pixels of empty space. Only present if C is present. | 60 // _: ToolbarActionsBar::PlatformSettings::item_spacing pixels of empty space. |
| 61 // c: GetChevronSpacing() pixels of empty space. Only present if C is present. |
| 61 // C: An optional chevron, as wide as the IDR_BROWSER_ACTIONS_OVERFLOW image, | 62 // C: An optional chevron, as wide as the IDR_BROWSER_ACTIONS_OVERFLOW image, |
| 62 // and visible only when both of the following statements are true: | 63 // and visible only when both of the following statements are true: |
| 63 // - The container is set to a width smaller than needed to show all icons. | 64 // - The container is set to a width smaller than needed to show all icons. |
| 64 // - There is no other container in 'overflow' mode to handle the | 65 // - There is no other container in 'overflow' mode to handle the |
| 65 // non-visible icons for this container. | 66 // non-visible icons for this container. |
| 66 // s: ToolbarView::kStandardSpacing pixels of empty space (before the app | 67 // s: GetLayoutConstant(TOOLBAR_STANDARD_SPACING) pixels of empty space |
| 67 // menu). | 68 // (before the app menu). |
| 68 // The reason the container contains the trailing space "s", rather than having | 69 // The reason the container contains the trailing space "s", rather than having |
| 69 // it be handled by the parent view, is so that when the chevron is invisible | 70 // it be handled by the parent view, is so that when the chevron is invisible |
| 70 // and the user starts dragging an icon around, we have the space to draw the | 71 // and the user starts dragging an icon around, we have the space to draw the |
| 71 // ultimate drop indicator. (Otherwise, we'd be trying to draw it into the | 72 // ultimate drop indicator. (Otherwise, we'd be trying to draw it into the |
| 72 // padding beyond our right edge, and it wouldn't appear.) | 73 // padding beyond our right edge, and it wouldn't appear.) |
| 73 // | 74 // |
| 74 // The BrowserActionsContainer in 'main' mode follows a few rules, in terms of | 75 // The BrowserActionsContainer in 'main' mode follows a few rules, in terms of |
| 75 // user experience: | 76 // user experience: |
| 76 // | 77 // |
| 77 // 1) The container can never grow beyond the space needed to show all icons | 78 // 1) The container can never grow beyond the space needed to show all icons |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // The class that registers for keyboard shortcuts for extension commands. | 348 // The class that registers for keyboard shortcuts for extension commands. |
| 348 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; | 349 scoped_ptr<ExtensionKeybindingRegistryViews> extension_keybinding_registry_; |
| 349 | 350 |
| 350 // The extension bubble that is actively showing, if any. | 351 // The extension bubble that is actively showing, if any. |
| 351 views::BubbleDelegateView* active_bubble_; | 352 views::BubbleDelegateView* active_bubble_; |
| 352 | 353 |
| 353 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); | 354 DISALLOW_COPY_AND_ASSIGN(BrowserActionsContainer); |
| 354 }; | 355 }; |
| 355 | 356 |
| 356 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ | 357 #endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_BROWSER_ACTIONS_CONTAINER_H_ |
| OLD | NEW |