OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 #include "chrome/browser/ui/layout_constants.h" | 5 #include "chrome/browser/ui/layout_constants.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "ui/base/material_design/material_design_controller.h" | 9 #include "ui/base/material_design/material_design_controller.h" |
10 | 10 |
11 int GetLayoutConstant(LayoutConstant constant) { | 11 int GetLayoutConstant(LayoutConstant constant) { |
12 const int kFindBarVerticalOffset[] = {1, 6, 6}; | 12 const int kFindBarVerticalOffset[] = {1, 6, 6}; |
13 const int kLocationBarBorderThickness[] = {2, 1, 1}; | 13 const int kLocationBarBorderThickness[] = {2, 1, 1}; |
14 const int kLocationBarBubbleFontVerticalPadding[] = {1, 2, 4}; | 14 const int kLocationBarBubbleFontVerticalPadding[] = {1, 2, 4}; |
15 const int kLocationBarBubbleHorizontalPadding[] = {1, 0, 0}; | 15 const int kLocationBarBubbleHorizontalPadding[] = {1, 0, 0}; |
16 const int kLocationBarBubbleVerticalPadding[] = {1, 3, 3}; | 16 const int kLocationBarBubbleVerticalPadding[] = {1, 3, 3}; |
17 const int kLocationBarBubbleAnchorVerticalInset[] = {5, 6, 8}; | 17 const int kLocationBarBubbleAnchorVerticalInset[] = {5, 6, 8}; |
18 const int kLocationBarHeight[] = {27, 28, 32}; | 18 const int kLocationBarHeight[] = {27, 28, 32}; |
19 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; | 19 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; |
20 const int kLocationBarVerticalPadding[] = {0, 1, 1}; | 20 const int kLocationBarVerticalPadding[] = {0, 1, 1}; |
21 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; | 21 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; |
22 const int kOmniboxFontPixelSize[] = {16, 14, 14}; | 22 const int kOmniboxFontPixelSize[] = {16, 14, 14}; |
23 const int kTabCloseButtonTrailingPaddingOverlap[] = {2, 0, 0}; | |
24 const int kTabFaviconTitleSpacing[] = {4, 6, 6}; | 23 const int kTabFaviconTitleSpacing[] = {4, 6, 6}; |
25 const int kTabHeight[] = {29, 29, 33}; | 24 const int kTabHeight[] = {29, 29, 33}; |
26 const int kTabPinnedContentWidth[] = {25, 23, 23}; | 25 const int kTabPinnedContentWidth[] = {25, 23, 23}; |
27 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
28 const int kTabTopExclusionHeight[] = {0, 0, 0}; | |
29 const int kTabstripNewTabButtonOverlap[] = {8, 5, 6}; | 27 const int kTabstripNewTabButtonOverlap[] = {8, 5, 6}; |
30 const int kTabstripTabOverlap[] = {19, 16, 16}; | 28 const int kTabstripTabOverlap[] = {19, 16, 16}; |
31 #else | 29 #else |
32 const int kTabTopExclusionHeight[] = {2, 0, 0}; | |
33 const int kTabstripNewTabButtonOverlap[] = {11, 5, 6}; | 30 const int kTabstripNewTabButtonOverlap[] = {11, 5, 6}; |
34 const int kTabstripTabOverlap[] = {26, 16, 16}; | 31 const int kTabstripTabOverlap[] = {26, 16, 16}; |
35 #endif | 32 #endif |
36 const int kToolbarStandardSpacing[] = {3, 4, 8}; | 33 const int kToolbarStandardSpacing[] = {3, 4, 8}; |
37 const int kTabstripToolbarOverlap[] = {3, 0, 0}; | |
38 const int kToolbarContentShadowHeight[] = {0, 0, 0}; | |
39 const int kToolbarContentShadowHeightAsh[] = {2, 0, 0}; | |
40 const int kToolbarElementPadding[] = {0, 0, 8}; | 34 const int kToolbarElementPadding[] = {0, 0, 8}; |
41 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; | 35 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; |
42 | 36 |
43 const int mode = ui::MaterialDesignController::GetMode(); | 37 const int mode = ui::MaterialDesignController::GetMode(); |
44 switch (constant) { | 38 switch (constant) { |
45 case FIND_BAR_TOOLBAR_OVERLAP: | 39 case FIND_BAR_TOOLBAR_OVERLAP: |
46 return kFindBarVerticalOffset[mode]; | 40 return kFindBarVerticalOffset[mode]; |
47 case LOCATION_BAR_BORDER_THICKNESS: | 41 case LOCATION_BAR_BORDER_THICKNESS: |
48 return kLocationBarBorderThickness[mode]; | 42 return kLocationBarBorderThickness[mode]; |
49 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: | 43 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: |
(...skipping 11 matching lines...) Expand all Loading... |
61 case LOCATION_BAR_VERTICAL_PADDING: | 55 case LOCATION_BAR_VERTICAL_PADDING: |
62 return kLocationBarVerticalPadding[mode]; | 56 return kLocationBarVerticalPadding[mode]; |
63 case OMNIBOX_DROPDOWN_BORDER_INTERIOR: | 57 case OMNIBOX_DROPDOWN_BORDER_INTERIOR: |
64 return kOmniboxDropdownBorderInterior[mode]; | 58 return kOmniboxDropdownBorderInterior[mode]; |
65 case OMNIBOX_FONT_PIXEL_SIZE: | 59 case OMNIBOX_FONT_PIXEL_SIZE: |
66 return kOmniboxFontPixelSize[mode]; | 60 return kOmniboxFontPixelSize[mode]; |
67 case TABSTRIP_NEW_TAB_BUTTON_OVERLAP: | 61 case TABSTRIP_NEW_TAB_BUTTON_OVERLAP: |
68 return kTabstripNewTabButtonOverlap[mode]; | 62 return kTabstripNewTabButtonOverlap[mode]; |
69 case TABSTRIP_TAB_OVERLAP: | 63 case TABSTRIP_TAB_OVERLAP: |
70 return kTabstripTabOverlap[mode]; | 64 return kTabstripTabOverlap[mode]; |
71 case TABSTRIP_TOOLBAR_OVERLAP: | |
72 return kTabstripToolbarOverlap[mode]; | |
73 case TAB_CLOSE_BUTTON_TRAILING_PADDING_OVERLAP: | |
74 return kTabCloseButtonTrailingPaddingOverlap[mode]; | |
75 case TAB_FAVICON_TITLE_SPACING: | 65 case TAB_FAVICON_TITLE_SPACING: |
76 return kTabFaviconTitleSpacing[mode]; | 66 return kTabFaviconTitleSpacing[mode]; |
77 case TAB_HEIGHT: | 67 case TAB_HEIGHT: |
78 return kTabHeight[mode]; | 68 return kTabHeight[mode]; |
79 case TAB_PINNED_CONTENT_WIDTH: | 69 case TAB_PINNED_CONTENT_WIDTH: |
80 return kTabPinnedContentWidth[mode]; | 70 return kTabPinnedContentWidth[mode]; |
81 case TAB_TOP_EXCLUSION_HEIGHT: | |
82 return kTabTopExclusionHeight[mode]; | |
83 case TOOLBAR_CONTENT_SHADOW_HEIGHT: | |
84 return kToolbarContentShadowHeight[mode]; | |
85 case TOOLBAR_CONTENT_SHADOW_HEIGHT_ASH: | |
86 return kToolbarContentShadowHeightAsh[mode]; | |
87 case TOOLBAR_ELEMENT_PADDING: | 71 case TOOLBAR_ELEMENT_PADDING: |
88 return kToolbarElementPadding[mode]; | 72 return kToolbarElementPadding[mode]; |
89 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: | 73 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: |
90 return kToolbarLocationBarRightPadding[mode]; | 74 return kToolbarLocationBarRightPadding[mode]; |
91 case TOOLBAR_STANDARD_SPACING: | 75 case TOOLBAR_STANDARD_SPACING: |
92 return kToolbarStandardSpacing[mode]; | 76 return kToolbarStandardSpacing[mode]; |
93 } | 77 } |
94 NOTREACHED(); | 78 NOTREACHED(); |
95 return 0; | 79 return 0; |
96 } | 80 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 const int kNewTabButtonHeight[] = {18, 18, 21}; | 125 const int kNewTabButtonHeight[] = {18, 18, 21}; |
142 | 126 |
143 const int mode = ui::MaterialDesignController::GetMode(); | 127 const int mode = ui::MaterialDesignController::GetMode(); |
144 switch (size) { | 128 switch (size) { |
145 case NEW_TAB_BUTTON: | 129 case NEW_TAB_BUTTON: |
146 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); | 130 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); |
147 } | 131 } |
148 NOTREACHED(); | 132 NOTREACHED(); |
149 return gfx::Size(); | 133 return gfx::Size(); |
150 } | 134 } |
OLD | NEW |