Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2015 The Chromium Authors |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
estade | d485dfe9 | 2015-12-09 02:50:28 | [diff] [blame] | 5 | #ifndef CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_ |
| 6 | #define CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_ |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 7 | |
Malay Keshav | 4331b46 | 2018-03-02 04:17:48 | [diff] [blame] | 8 | #include "build/build_config.h" |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 9 | #include "ui/gfx/geometry/insets.h" |
pkasting | e3764e3 | 2015-12-28 13:10:57 | [diff] [blame] | 10 | #include "ui/gfx/geometry/size.h" |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 11 | |
| 12 | enum LayoutConstant { |
Elaine Chien | c502942 | 2023-05-23 23:55:52 | [diff] [blame] | 13 | // The size of the avatar icon in the profile row of the app menu. |
| 14 | APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE, |
| 15 | |
Elaine Chien | 146e03f1 | 2023-06-06 18:14:06 | [diff] [blame] | 16 | // The maximum character length for strings in the app menu. |
| 17 | APP_MENU_MAXIMUM_CHARACTER_LENGTH, |
| 18 | |
Charlene Yan | 2cbdecbb | 2018-08-30 18:20:16 | [diff] [blame] | 19 | // The height of Bookmarks Bar when attached to the toolbar. The height of the |
| 20 | // Bookmarks Bar is larger than the BOOKMARK_BAR_BUTTON_HEIGHT by a fixed |
| 21 | // amount. |
Malay Keshav | 4331b46 | 2018-03-02 04:17:48 | [diff] [blame] | 22 | BOOKMARK_BAR_HEIGHT, |
| 23 | |
Charlene Yan | 2cbdecbb | 2018-08-30 18:20:16 | [diff] [blame] | 24 | // The height of a button within the Bookmarks Bar. |
| 25 | BOOKMARK_BAR_BUTTON_HEIGHT, |
| 26 | |
Emily Shack | 6346a45 | 2023-05-26 21:44:09 | [diff] [blame] | 27 | // The horizontal padding between buttons within the Bookmarks Bar. |
| 28 | BOOKMARK_BAR_BUTTON_PADDING, |
| 29 | |
David Pennington | 23b32b4 | 2023-06-01 19:58:48 | [diff] [blame] | 30 | // The horizontal padding between the image and the title of the bookmark |
| 31 | // button. |
| 32 | BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING, |
| 33 | |
Rohit Bhatia | 0df5b5e | 2022-02-17 19:02:23 | [diff] [blame] | 34 | // The size of icons used in Download bubbles. |
Alison Gale | 9130192 | 2024-04-15 19:35:27 | [diff] [blame] | 35 | // TODO(crbug.com/40214740): We should be sourcing the size of the file icon |
| 36 | // from |
Rohit Bhatia | 0df5b5e | 2022-02-17 19:02:23 | [diff] [blame] | 37 | // the layout |
| 38 | // provider rather than relying on hardcoded constants. |
| 39 | DOWNLOAD_ICON_SIZE, |
| 40 | |
tdanderson | bc81f90a | 2016-02-26 04:12:22 | [diff] [blame] | 41 | // The vertical padding between the edge of a location bar bubble and its |
| 42 | // contained text. |
| 43 | LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING, |
| 44 | |
varkha | f9c72062 | 2016-04-05 01:34:05 | [diff] [blame] | 45 | // The vertical inset to apply to the bounds of a location bar bubble's anchor |
| 46 | // view, to bring the bubble closer to the anchor. This compensates for the |
| 47 | // space between the bottoms of most such views and the visible bottoms of the |
| 48 | // images inside. |
| 49 | LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET, |
| 50 | |
Jay Harris | 2a4ef3e | 2019-03-05 01:02:58 | [diff] [blame] | 51 | // The internal padding to use inside children of the location bar. |
| 52 | LOCATION_BAR_CHILD_INTERIOR_PADDING, |
| 53 | |
Erik Chen | 8aa403c | 2023-06-22 05:46:57 | [diff] [blame] | 54 | // The corner radius to use for children of the location bar. |
| 55 | LOCATION_BAR_CHILD_CORNER_RADIUS, |
| 56 | |
Elias Klim | 58b13f0 | 2024-02-14 10:44:27 | [diff] [blame] | 57 | // The size of icons within chips inside the location bar. |
| 58 | LOCATION_BAR_CHIP_ICON_SIZE, |
| 59 | |
| 60 | // The internal padding to use inside an indicator chip, permission request |
| 61 | // chip and between chips in the location bar. |
| 62 | LOCATION_BAR_CHIP_PADDING, |
| 63 | |
manuk | a852107f | 2018-08-27 15:14:08 | [diff] [blame] | 64 | // The vertical and horizontal padding inside the border. |
estade | 39f5ad1 | 2017-01-26 01:45:17 | [diff] [blame] | 65 | LOCATION_BAR_ELEMENT_PADDING, |
| 66 | |
estade | 55703dc3 | 2016-09-20 18:38:12 | [diff] [blame] | 67 | // The height to be occupied by the LocationBar. |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 68 | LOCATION_BAR_HEIGHT, |
| 69 | |
Shibalik Mohapatra | 56d1d2b5 | 2023-03-30 05:40:56 | [diff] [blame] | 70 | // The vertical margins from the page info icon |
| 71 | LOCATION_BAR_PAGE_INFO_ICON_VERTICAL_PADDING, |
| 72 | |
| 73 | // The leading edge space in the omnibox from the LHS icons used in Chrome |
| 74 | // with the chrome refresh flag. |
| 75 | LOCATION_BAR_LEADING_DECORATION_EDGE_PADDING, |
| 76 | |
| 77 | // The trailing edge space in the omnibox from the RHS icons used in Chrome |
| 78 | // with the chrome refresh flag. |
| 79 | LOCATION_BAR_TRAILING_DECORATION_EDGE_PADDING, |
| 80 | |
Thomas Lukaszewicz | 97453e92 | 2024-07-17 00:42:28 | [diff] [blame] | 81 | // The padding between trailing edge decorations and the inner views of the |
| 82 | // omnibox. |
| 83 | LOCATION_BAR_TRAILING_DECORATION_INNER_PADDING, |
| 84 | |
Patti | 771152fe | 2018-02-19 02:33:12 | [diff] [blame] | 85 | // The size of the icons used inside the LocationBar. |
Alison Gale | 3f4203f7 | 2024-04-26 19:27:42 | [diff] [blame] | 86 | // TODO(crbug.com/40883435): Deprecate this after the size of all location bar |
Shibalik Mohapatra | 89d13f26 | 2023-03-27 22:36:09 | [diff] [blame] | 87 | // icons have moved to |
| 88 | // either `LOCATION_BAR_LEADING_ICON_SIZE` or |
| 89 | // `LOCATION_BAR_TRAILING_ICON_SIZE` |
Patti | 771152fe | 2018-02-19 02:33:12 | [diff] [blame] | 90 | LOCATION_BAR_ICON_SIZE, |
| 91 | |
Shibalik Mohapatra | 89d13f26 | 2023-03-27 22:36:09 | [diff] [blame] | 92 | // The size of the leading icons used inside the LocationBar. |
| 93 | LOCATION_BAR_LEADING_ICON_SIZE, |
| 94 | |
| 95 | // The size of the trailing icons used inside the LocationBar. |
| 96 | LOCATION_BAR_TRAILING_ICON_SIZE, |
| 97 | |
Olesia Marukhno | 0429a54 | 2021-06-21 09:43:20 | [diff] [blame] | 98 | // The size of icons used in PageInfo bubbles. |
| 99 | PAGE_INFO_ICON_SIZE, |
| 100 | |
Malay Keshav | 4331b46 | 2018-03-02 04:17:48 | [diff] [blame] | 101 | // Padding after the tab title. |
| 102 | TAB_AFTER_TITLE_PADDING, |
| 103 | |
| 104 | // Width of the alert indicator shown for a tab using media capture. |
| 105 | TAB_ALERT_INDICATOR_CAPTURE_ICON_WIDTH, |
| 106 | |
| 107 | // Width of the alert indicator icon displayed in the tab. The same width is |
| 108 | // used for all 3 states of normal, hovered and pressed. |
| 109 | TAB_ALERT_INDICATOR_ICON_WIDTH, |
| 110 | |
Taylor Bergquist | 3944f92 | 2023-06-15 22:48:35 | [diff] [blame] | 111 | // Width and height of the tab close button. |
| 112 | TAB_CLOSE_BUTTON_SIZE, |
| 113 | |
pkasting | e3764e3 | 2015-12-28 13:10:57 | [diff] [blame] | 114 | // The height of a tab, including outer strokes. In non-100% scales this is |
| 115 | // slightly larger than the apparent height of the tab, as the top stroke is |
| 116 | // drawn as a 1-px line flush with the bottom of the tab's topmost DIP. |
| 117 | TAB_HEIGHT, |
pkasting | ba6a410 | 2015-09-19 01:05:20 | [diff] [blame] | 118 | |
Taylor Bergquist | a1508ff | 2023-08-04 19:01:23 | [diff] [blame] | 119 | // The total tab strip height, including all interior padding. |
| 120 | TAB_STRIP_HEIGHT, |
| 121 | |
Taylor Bergquist | e2f52ddd | 2023-08-01 21:59:25 | [diff] [blame] | 122 | // The padding value shared between the area above the tab, the bottom of the |
| 123 | // detached tab, and on all sides of the controls padding. |
| 124 | TAB_STRIP_PADDING, |
| 125 | |
David Pennington | 568bb71 | 2023-06-06 23:40:44 | [diff] [blame] | 126 | // The height of a separator in the tabstrip. |
| 127 | TAB_SEPARATOR_HEIGHT, |
| 128 | |
Malay Keshav | 4331b46 | 2018-03-02 04:17:48 | [diff] [blame] | 129 | // Padding before the tab title. |
| 130 | TAB_PRE_TITLE_PADDING, |
| 131 | |
| 132 | // The distance between the edge of one tab to the corresponding edge or the |
| 133 | // subsequent tab when tabs are stacked. |
| 134 | TAB_STACK_DISTANCE, |
| 135 | |
Taylor Bergquist | c18d199 | 2018-07-11 22:40:34 | [diff] [blame] | 136 | // In refresh, tabs are drawn with an extension into the toolbar's |
| 137 | // space to prevent a gap from appearing between the toolbar and the |
| 138 | // bottom of tabs on some non-integral scales. |
| 139 | // TODO(tbergquist): Remove this after pixel canvas or any deeper fix to |
| 140 | // non-pixel-aligned drawing goes in. See https://crbug.com/765723. |
| 141 | TABSTRIP_TOOLBAR_OVERLAP, |
| 142 | |
Taylor Bergquist | 3174160 | 2019-11-06 22:57:34 | [diff] [blame] | 143 | // The total height, including icons and insets, of buttons in the toolbar. |
| 144 | TOOLBAR_BUTTON_HEIGHT, |
| 145 | |
Caroline Rising | c907f0b | 2023-10-31 19:51:39 | [diff] [blame] | 146 | // The corner radius for a divider in the toolbar. |
| 147 | TOOLBAR_DIVIDER_CORNER_RADIUS, |
| 148 | |
| 149 | // The height for a divider in the toolbar. |
| 150 | TOOLBAR_DIVIDER_HEIGHT, |
| 151 | |
| 152 | // The horizontal space on either side of a divider in the toolbar. |
| 153 | TOOLBAR_DIVIDER_SPACING, |
| 154 | |
| 155 | // The width for a divider in the toolbar. |
| 156 | TOOLBAR_DIVIDER_WIDTH, |
| 157 | |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 158 | // Additional horizontal padding between the elements in the toolbar. |
pkasting | 5e02deb | 2015-09-19 04:17:31 | [diff] [blame] | 159 | TOOLBAR_ELEMENT_PADDING, |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 160 | |
Shibalik Mohapatra | d03b463 | 2023-03-30 17:54:32 | [diff] [blame] | 161 | // Default margin of the toolbar icons set by the layout manager. |
| 162 | TOOLBAR_ICON_DEFAULT_MARGIN, |
| 163 | |
pkasting | 5e02deb | 2015-09-19 04:17:31 | [diff] [blame] | 164 | // The horizontal space between most items in the toolbar. |
| 165 | TOOLBAR_STANDARD_SPACING, |
Olesia Marukhno | 0429a54 | 2021-06-21 09:43:20 | [diff] [blame] | 166 | |
Shibalik Mohapatra | acdd445 | 2023-03-03 17:26:36 | [diff] [blame] | 167 | // corner radius on the top of the toolbar introduced in chrome refresh 2023 |
| 168 | TOOLBAR_CORNER_RADIUS, |
| 169 | |
Olesia Marukhno | 0429a54 | 2021-06-21 09:43:20 | [diff] [blame] | 170 | // The size of the app menu button in a web app browser window. |
| 171 | WEB_APP_MENU_BUTTON_SIZE, |
| 172 | |
| 173 | // The size of page action icons in a web app title bar. |
| 174 | WEB_APP_PAGE_ACTION_ICON_SIZE, |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 175 | }; |
| 176 | |
| 177 | enum LayoutInset { |
Rohit Bhatia | 0df5b5e | 2022-02-17 19:02:23 | [diff] [blame] | 178 | // The padding around icons used in Download bubbles. |
| 179 | DOWNLOAD_ICON, |
| 180 | |
Rohit Bhatia | 610f636d | 2022-07-14 00:54:16 | [diff] [blame] | 181 | // The padding around rows used in Download bubbles. |
| 182 | DOWNLOAD_ROW, |
| 183 | |
Tommy C. Li | 1e07aad | 2018-06-08 20:09:02 | [diff] [blame] | 184 | // The padding used around the icon inside the LocationBar. The full width of |
| 185 | // the icon would be LOCATION_BAR_ICON_SIZE + 2 * inset.width(). The full |
| 186 | // height of the icon would be LOCATION_BAR_ICON_SIZE + 2 * inset.height(). |
| 187 | // Icons may additionally be spaced horizontally by |
| 188 | // LOCATION_BAR_ELEMENT_PADDING, but this region is not part of the icon view |
| 189 | // (e.g. does not highlight on hover). |
| 190 | LOCATION_BAR_ICON_INTERIOR_PADDING, |
| 191 | |
Shibalik Mohapatra | 56d1d2b5 | 2023-03-30 05:40:56 | [diff] [blame] | 192 | // The page info icon in the location bar has different insets than the other |
| 193 | // icons with chrome refresh flag. |
| 194 | LOCATION_BAR_PAGE_INFO_ICON_PADDING, |
| 195 | |
| 196 | // The page action icons in the location bar have different insets than the |
| 197 | // other icons with chrome refresh flag. |
| 198 | LOCATION_BAR_PAGE_ACTION_ICON_PADDING, |
| 199 | |
Ahmed Fakhry | bd46594 | 2018-03-22 03:19:56 | [diff] [blame] | 200 | // The padding inside the border of a toolbar action view button. |
| 201 | TOOLBAR_ACTION_VIEW, |
Jay Harris | fb13af2 | 2019-02-19 17:50:37 | [diff] [blame] | 202 | |
Tom Lukaszewicz | 532682dd | 2022-04-14 18:41:49 | [diff] [blame] | 203 | // The padding inside the border of a toolbar button (around the image). |
| 204 | TOOLBAR_BUTTON, |
| 205 | |
Shibalik Mohapatra | f2123382 | 2023-06-02 18:12:16 | [diff] [blame] | 206 | // The padding around the browser app menu chip. |
| 207 | BROWSER_APP_MENU_CHIP_PADDING, |
| 208 | |
Shibalik Mohapatra | 74c6d80 | 2023-06-08 00:46:11 | [diff] [blame] | 209 | // The padding around the profile menu chip. |
| 210 | AVATAR_CHIP_PADDING, |
| 211 | |
Jay Harris | fb13af2 | 2019-02-19 17:50:37 | [diff] [blame] | 212 | // The padding between the edges of the toolbar and its content. |
| 213 | TOOLBAR_INTERIOR_MARGIN, |
Tom Lukaszewicz | 532682dd | 2022-04-14 18:41:49 | [diff] [blame] | 214 | |
| 215 | // The padding between the edges of the toolbar and its content when the webui |
| 216 | // tab strip is enabled. Special handling is needed as when the browser is |
| 217 | // maximized and the tabstrip is collapsed the toolbar will sit flush with the |
| 218 | // edge of the screen. |
| 219 | WEBUI_TAB_STRIP_TOOLBAR_INTERIOR_MARGIN, |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | int GetLayoutConstant(LayoutConstant constant); |
Wei Li | c29efd5 | 2018-05-03 16:32:09 | [diff] [blame] | 223 | |
pkasting | 903dcef | 2015-09-15 19:58:13 | [diff] [blame] | 224 | gfx::Insets GetLayoutInsets(LayoutInset inset); |
| 225 | |
estade | d485dfe9 | 2015-12-09 02:50:28 | [diff] [blame] | 226 | #endif // CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_ |