1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_
6 #define CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_
7 
8 #include "build/build_config.h"
9 #include "ui/gfx/geometry/insets.h"
10 #include "ui/gfx/geometry/size.h"
11 
12 enum LayoutConstant {
13   // The height of Bookmarks Bar when attached to the toolbar. The height of the
14   // Bookmarks Bar is larger than the BOOKMARK_BAR_BUTTON_HEIGHT by a fixed
15   // amount.
16   BOOKMARK_BAR_HEIGHT,
17 
18   // The height of a button within the Bookmarks Bar.
19   BOOKMARK_BAR_BUTTON_HEIGHT,
20 
21 #if defined(OS_MAC)
22   // This is a little smaller than the bookmarkbar height because of the visual
23   // overlap with the main toolbar. This height should not be used when
24   // computing the height of the toolbar.
25   BOOKMARK_BAR_HEIGHT_NO_OVERLAP,
26 #endif
27 
28   // The height of Bookmarks Bar, when visible in "New Tab Page" mode.
29   BOOKMARK_BAR_NTP_HEIGHT,
30 
31 #if defined(OS_MAC)
32   // The amount of space between the inner bookmark bar and the outer toolbar on
33   // new tab pages.
34   BOOKMARK_BAR_NTP_PADDING,
35 #endif
36 
37   // The size of the app menu button in a web app browser window.
38   WEB_APP_MENU_BUTTON_SIZE,
39 
40   // The size of page action icons in a web app title bar.
41   WEB_APP_PAGE_ACTION_ICON_SIZE,
42 
43   // The vertical padding between the edge of a location bar bubble and its
44   // contained text.
45   LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING,
46 
47   // The vertical inset to apply to the bounds of a location bar bubble's anchor
48   // view, to bring the bubble closer to the anchor.  This compensates for the
49   // space between the bottoms of most such views and the visible bottoms of the
50   // images inside.
51   LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET,
52 
53   // The internal padding to use inside children of the location bar.
54   LOCATION_BAR_CHILD_INTERIOR_PADDING,
55 
56   // The vertical and horizontal padding inside the border.
57   LOCATION_BAR_ELEMENT_PADDING,
58 
59   // The height to be occupied by the LocationBar.
60   LOCATION_BAR_HEIGHT,
61 
62   // The size of the icons used inside the LocationBar.
63   LOCATION_BAR_ICON_SIZE,
64 
65   // Padding after the tab title.
66   TAB_AFTER_TITLE_PADDING,
67 
68   // Width of the alert indicator shown for a tab using media capture.
69   TAB_ALERT_INDICATOR_CAPTURE_ICON_WIDTH,
70 
71   // Width of the alert indicator icon displayed in the tab. The same width is
72   // used for all 3 states of normal, hovered and pressed.
73   TAB_ALERT_INDICATOR_ICON_WIDTH,
74 
75   // The height of a tab, including outer strokes.  In non-100% scales this is
76   // slightly larger than the apparent height of the tab, as the top stroke is
77   // drawn as a 1-px line flush with the bottom of the tab's topmost DIP.
78   TAB_HEIGHT,
79 
80   // Padding before the tab title.
81   TAB_PRE_TITLE_PADDING,
82 
83   // The distance between the edge of one tab to the corresponding edge or the
84   // subsequent tab when tabs are stacked.
85   TAB_STACK_DISTANCE,
86 
87   // In refresh, tabs are drawn with an extension into the toolbar's
88   // space to prevent a gap from appearing between the toolbar and the
89   // bottom of tabs on some non-integral scales.
90   // TODO(tbergquist): Remove this after pixel canvas or any deeper fix to
91   // non-pixel-aligned drawing goes in.  See https://crbug.com/765723.
92   TABSTRIP_TOOLBAR_OVERLAP,
93 
94   // The horizontal padding between any right aligned controls and the end of
95   // the TabStripRegionView.
96   TABSTRIP_REGION_VIEW_CONTROL_PADDING,
97 
98   // The total height, including icons and insets, of buttons in the toolbar.
99   TOOLBAR_BUTTON_HEIGHT,
100 
101   // Additional horizontal padding between the elements in the toolbar.
102   TOOLBAR_ELEMENT_PADDING,
103 
104   // The horizontal space between most items in the toolbar.
105   TOOLBAR_STANDARD_SPACING,
106 };
107 
108 enum LayoutInset {
109   // The padding used around the icon inside the LocationBar. The full width of
110   // the icon would be LOCATION_BAR_ICON_SIZE + 2 * inset.width(). The full
111   // height of the icon would be LOCATION_BAR_ICON_SIZE + 2 * inset.height().
112   // Icons may additionally be spaced horizontally by
113   // LOCATION_BAR_ELEMENT_PADDING, but this region is not part of the icon view
114   // (e.g. does not highlight on hover).
115   LOCATION_BAR_ICON_INTERIOR_PADDING,
116 
117   // The padding inside the border of a toolbar button (around the image).
118   TOOLBAR_BUTTON,
119 
120   // The padding inside the border of a toolbar action view button.
121   TOOLBAR_ACTION_VIEW,
122 
123   // The padding between the edges of the toolbar and its content.
124   TOOLBAR_INTERIOR_MARGIN,
125 };
126 
127 int GetLayoutConstant(LayoutConstant constant);
128 #if defined(OS_MAC)
129 // Use this function instead of GetLayoutConstant() for Cocoa browser.
130 // This will handle Cocoa specific layout constants. For non Cocoa specific
131 // constants, it will call GetLayoutConstant() anyway.
132 int GetCocoaLayoutConstant(LayoutConstant constant);
133 #endif
134 
135 gfx::Insets GetLayoutInsets(LayoutInset inset);
136 
137 #endif  // CHROME_BROWSER_UI_LAYOUT_CONSTANTS_H_
138