blob: a35795ee8cc118f08f05900d6f81ef16ec5f0ce3 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2015 The Chromium Authors
pkasting903dcef2015-09-15 19:58:132// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
estaded485dfe92015-12-09 02:50:285#ifndef CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_
6#define CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_
pkasting903dcef2015-09-15 19:58:137
Malay Keshav4331b462018-03-02 04:17:488#include "build/build_config.h"
pkasting903dcef2015-09-15 19:58:139#include "ui/gfx/geometry/insets.h"
pkastinge3764e32015-12-28 13:10:5710#include "ui/gfx/geometry/size.h"
pkasting903dcef2015-09-15 19:58:1311
12enum LayoutConstant {
Elaine Chienc5029422023-05-23 23:55:5213 // The size of the avatar icon in the profile row of the app menu.
14 APP_MENU_PROFILE_ROW_AVATAR_ICON_SIZE,
15
Elaine Chien146e03f12023-06-06 18:14:0616 // The maximum character length for strings in the app menu.
17 APP_MENU_MAXIMUM_CHARACTER_LENGTH,
18
Charlene Yan2cbdecbb2018-08-30 18:20:1619 // 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 Keshav4331b462018-03-02 04:17:4822 BOOKMARK_BAR_HEIGHT,
23
Charlene Yan2cbdecbb2018-08-30 18:20:1624 // The height of a button within the Bookmarks Bar.
25 BOOKMARK_BAR_BUTTON_HEIGHT,
26
Emily Shack6346a452023-05-26 21:44:0927 // The horizontal padding between buttons within the Bookmarks Bar.
28 BOOKMARK_BAR_BUTTON_PADDING,
29
David Pennington23b32b42023-06-01 19:58:4830 // The horizontal padding between the image and the title of the bookmark
31 // button.
32 BOOKMARK_BAR_BUTTON_IMAGE_LABEL_PADDING,
33
Rohit Bhatia0df5b5e2022-02-17 19:02:2334 // The size of icons used in Download bubbles.
Alison Gale91301922024-04-15 19:35:2735 // TODO(crbug.com/40214740): We should be sourcing the size of the file icon
36 // from
Rohit Bhatia0df5b5e2022-02-17 19:02:2337 // the layout
38 // provider rather than relying on hardcoded constants.
39 DOWNLOAD_ICON_SIZE,
40
tdandersonbc81f90a2016-02-26 04:12:2241 // The vertical padding between the edge of a location bar bubble and its
42 // contained text.
43 LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING,
44
varkhaf9c720622016-04-05 01:34:0545 // 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 Harris2a4ef3e2019-03-05 01:02:5851 // The internal padding to use inside children of the location bar.
52 LOCATION_BAR_CHILD_INTERIOR_PADDING,
53
Erik Chen8aa403c2023-06-22 05:46:5754 // The corner radius to use for children of the location bar.
55 LOCATION_BAR_CHILD_CORNER_RADIUS,
56
Elias Klim58b13f02024-02-14 10:44:2757 // 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
manuka852107f2018-08-27 15:14:0864 // The vertical and horizontal padding inside the border.
estade39f5ad12017-01-26 01:45:1765 LOCATION_BAR_ELEMENT_PADDING,
66
estade55703dc32016-09-20 18:38:1267 // The height to be occupied by the LocationBar.
pkasting903dcef2015-09-15 19:58:1368 LOCATION_BAR_HEIGHT,
69
Shibalik Mohapatra56d1d2b52023-03-30 05:40:5670 // 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 Lukaszewicz97453e922024-07-17 00:42:2881 // The padding between trailing edge decorations and the inner views of the
82 // omnibox.
83 LOCATION_BAR_TRAILING_DECORATION_INNER_PADDING,
84
Patti771152fe2018-02-19 02:33:1285 // The size of the icons used inside the LocationBar.
Alison Gale3f4203f72024-04-26 19:27:4286 // TODO(crbug.com/40883435): Deprecate this after the size of all location bar
Shibalik Mohapatra89d13f262023-03-27 22:36:0987 // icons have moved to
88 // either `LOCATION_BAR_LEADING_ICON_SIZE` or
89 // `LOCATION_BAR_TRAILING_ICON_SIZE`
Patti771152fe2018-02-19 02:33:1290 LOCATION_BAR_ICON_SIZE,
91
Shibalik Mohapatra89d13f262023-03-27 22:36:0992 // 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 Marukhno0429a542021-06-21 09:43:2098 // The size of icons used in PageInfo bubbles.
99 PAGE_INFO_ICON_SIZE,
100
Malay Keshav4331b462018-03-02 04:17:48101 // 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 Bergquist3944f922023-06-15 22:48:35111 // Width and height of the tab close button.
112 TAB_CLOSE_BUTTON_SIZE,
113
pkastinge3764e32015-12-28 13:10:57114 // 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,
pkastingba6a4102015-09-19 01:05:20118
Taylor Bergquista1508ff2023-08-04 19:01:23119 // The total tab strip height, including all interior padding.
120 TAB_STRIP_HEIGHT,
121
Taylor Bergquiste2f52ddd2023-08-01 21:59:25122 // 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 Pennington568bb712023-06-06 23:40:44126 // The height of a separator in the tabstrip.
127 TAB_SEPARATOR_HEIGHT,
128
Malay Keshav4331b462018-03-02 04:17:48129 // 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 Bergquistc18d1992018-07-11 22:40:34136 // 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 Bergquist31741602019-11-06 22:57:34143 // The total height, including icons and insets, of buttons in the toolbar.
144 TOOLBAR_BUTTON_HEIGHT,
145
Caroline Risingc907f0b2023-10-31 19:51:39146 // 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
pkasting903dcef2015-09-15 19:58:13158 // Additional horizontal padding between the elements in the toolbar.
pkasting5e02deb2015-09-19 04:17:31159 TOOLBAR_ELEMENT_PADDING,
pkasting903dcef2015-09-15 19:58:13160
Shibalik Mohapatrad03b4632023-03-30 17:54:32161 // Default margin of the toolbar icons set by the layout manager.
162 TOOLBAR_ICON_DEFAULT_MARGIN,
163
pkasting5e02deb2015-09-19 04:17:31164 // The horizontal space between most items in the toolbar.
165 TOOLBAR_STANDARD_SPACING,
Olesia Marukhno0429a542021-06-21 09:43:20166
Shibalik Mohapatraacdd4452023-03-03 17:26:36167 // corner radius on the top of the toolbar introduced in chrome refresh 2023
168 TOOLBAR_CORNER_RADIUS,
169
Olesia Marukhno0429a542021-06-21 09:43:20170 // 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,
pkasting903dcef2015-09-15 19:58:13175};
176
177enum LayoutInset {
Rohit Bhatia0df5b5e2022-02-17 19:02:23178 // The padding around icons used in Download bubbles.
179 DOWNLOAD_ICON,
180
Rohit Bhatia610f636d2022-07-14 00:54:16181 // The padding around rows used in Download bubbles.
182 DOWNLOAD_ROW,
183
Tommy C. Li1e07aad2018-06-08 20:09:02184 // 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 Mohapatra56d1d2b52023-03-30 05:40:56192 // 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 Fakhrybd465942018-03-22 03:19:56200 // The padding inside the border of a toolbar action view button.
201 TOOLBAR_ACTION_VIEW,
Jay Harrisfb13af22019-02-19 17:50:37202
Tom Lukaszewicz532682dd2022-04-14 18:41:49203 // The padding inside the border of a toolbar button (around the image).
204 TOOLBAR_BUTTON,
205
Shibalik Mohapatraf21233822023-06-02 18:12:16206 // The padding around the browser app menu chip.
207 BROWSER_APP_MENU_CHIP_PADDING,
208
Shibalik Mohapatra74c6d802023-06-08 00:46:11209 // The padding around the profile menu chip.
210 AVATAR_CHIP_PADDING,
211
Jay Harrisfb13af22019-02-19 17:50:37212 // The padding between the edges of the toolbar and its content.
213 TOOLBAR_INTERIOR_MARGIN,
Tom Lukaszewicz532682dd2022-04-14 18:41:49214
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,
pkasting903dcef2015-09-15 19:58:13220};
221
222int GetLayoutConstant(LayoutConstant constant);
Wei Lic29efd52018-05-03 16:32:09223
pkasting903dcef2015-09-15 19:58:13224gfx::Insets GetLayoutInsets(LayoutInset inset);
225
estaded485dfe92015-12-09 02:50:28226#endif // CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_