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/views/layout_constants.h" | 5 #include "chrome/browser/ui/views/layout_constants.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/base/resource/material_design/material_design_controller.h" | 8 #include "ui/base/resource/material_design/material_design_controller.h" |
9 | 9 |
10 int GetLayoutConstant(LayoutConstant constant) { | 10 int GetLayoutConstant(LayoutConstant constant) { |
11 const int kIconLabelViewInternalPadding[] = {3, 2, 2}; | 11 const int kIconLabelViewInternalPadding[] = {3, 2, 2}; |
12 const int kIconLabelViewTrailingPadding[] = {2, 8, 8}; | 12 const int kIconLabelViewTrailingPadding[] = {2, 8, 8}; |
13 const int kLocationBarBubbleHorizontalPadding[] = {1, 5, 5}; | 13 const int kLocationBarBubbleHorizontalPadding[] = {1, 5, 5}; |
14 const int kLocationBarBubbleVerticalPadding[] = {1, 5, 5}; | 14 const int kLocationBarBubbleVerticalPadding[] = {1, 5, 5}; |
15 const int kLocationBarHeight[] = {0, 28, 32}; | 15 const int kLocationBarHeight[] = {0, 28, 32}; |
16 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; | 16 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; |
17 const int kLocationBarVerticalPadding[] = {2, 2, 2}; | 17 const int kLocationBarVerticalPadding[] = {2, 2, 2}; |
| 18 const int kNewTabButtonWidth[] = {34, 34, 34}; |
18 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; | 19 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; |
19 const int kOmniboxFontPixelSize[] = {16, 14, 14}; | 20 const int kOmniboxFontPixelSize[] = {16, 14, 14}; |
20 const int kTabCloseButtonTrailingPaddingOverlap[] = {2, 2, 2}; | 21 const int kTabCloseButtonTrailingPaddingOverlap[] = {2, 2, 2}; |
21 const int kTabFaviconTitleSpacing[] = {4, 4, 4}; | 22 const int kTabFaviconTitleSpacing[] = {4, 4, 4}; |
22 const int kTabMaximumTitleWidth[] = {175, 175, 175}; | 23 const int kTabMaximumTitleWidth[] = {175, 175, 175}; |
23 const int kTabPinnedContentWidth[] = {25, 25, 25}; | 24 const int kTabPinnedContentWidth[] = {25, 25, 25}; |
24 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 26 const int kTabstripNewTabButtonOverlap[] = {8, 8, 8}; |
25 const int kTabstripTabOverlap[] = {19, 19, 19}; | 27 const int kTabstripTabOverlap[] = {19, 19, 19}; |
26 #else | 28 #else |
| 29 const int kTabstripNewTabButtonOverlap[] = {11, 11, 11}; |
27 const int kTabstripTabOverlap[] = {26, 26, 26}; | 30 const int kTabstripTabOverlap[] = {26, 26, 26}; |
28 #endif | 31 #endif |
29 const int kTabstripToolbarOverlap[] = {3, 3, 3}; | 32 const int kTabstripToolbarOverlap[] = {3, 3, 3}; |
30 const int kToolbarContentShadowHeight[] = {0, 0, 0}; | 33 const int kToolbarContentShadowHeight[] = {0, 0, 0}; |
31 const int kToolbarContentShadowHeightAsh[] = {2, 0, 0}; | 34 const int kToolbarContentShadowHeightAsh[] = {2, 0, 0}; |
32 const int kToolbarElementPadding[] = {0, 0, 8}; | 35 const int kToolbarElementPadding[] = {0, 0, 8}; |
33 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; | 36 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; |
34 const int kToolbarStandardSpacing[] = {3, 4, 8}; | 37 const int kToolbarStandardSpacing[] = {3, 4, 8}; |
35 | 38 |
36 const int mode = ui::MaterialDesignController::GetMode(); | 39 const int mode = ui::MaterialDesignController::GetMode(); |
37 switch (constant) { | 40 switch (constant) { |
38 case ICON_LABEL_VIEW_INTERNAL_PADDING: | 41 case ICON_LABEL_VIEW_INTERNAL_PADDING: |
39 return kIconLabelViewInternalPadding[mode]; | 42 return kIconLabelViewInternalPadding[mode]; |
40 case ICON_LABEL_VIEW_TRAILING_PADDING: | 43 case ICON_LABEL_VIEW_TRAILING_PADDING: |
41 return kIconLabelViewTrailingPadding[mode]; | 44 return kIconLabelViewTrailingPadding[mode]; |
42 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: | 45 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: |
43 return kLocationBarBubbleHorizontalPadding[mode]; | 46 return kLocationBarBubbleHorizontalPadding[mode]; |
44 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: | 47 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: |
45 return kLocationBarBubbleVerticalPadding[mode]; | 48 return kLocationBarBubbleVerticalPadding[mode]; |
46 case LOCATION_BAR_HEIGHT: | 49 case LOCATION_BAR_HEIGHT: |
47 return kLocationBarHeight[mode]; | 50 return kLocationBarHeight[mode]; |
48 case LOCATION_BAR_HORIZONTAL_PADDING: | 51 case LOCATION_BAR_HORIZONTAL_PADDING: |
49 return kLocationBarHorizontalPadding[mode]; | 52 return kLocationBarHorizontalPadding[mode]; |
50 case LOCATION_BAR_VERTICAL_PADDING: | 53 case LOCATION_BAR_VERTICAL_PADDING: |
51 return kLocationBarVerticalPadding[mode]; | 54 return kLocationBarVerticalPadding[mode]; |
| 55 case NEW_TAB_BUTTON_WIDTH: |
| 56 return kNewTabButtonWidth[mode]; |
52 case OMNIBOX_DROPDOWN_BORDER_INTERIOR: | 57 case OMNIBOX_DROPDOWN_BORDER_INTERIOR: |
53 return kOmniboxDropdownBorderInterior[mode]; | 58 return kOmniboxDropdownBorderInterior[mode]; |
54 case OMNIBOX_FONT_PIXEL_SIZE: | 59 case OMNIBOX_FONT_PIXEL_SIZE: |
55 return kOmniboxFontPixelSize[mode]; | 60 return kOmniboxFontPixelSize[mode]; |
| 61 case TABSTRIP_NEW_TAB_BUTTON_OVERLAP: |
| 62 return kTabstripNewTabButtonOverlap[mode]; |
56 case TABSTRIP_TAB_OVERLAP: | 63 case TABSTRIP_TAB_OVERLAP: |
57 return kTabstripTabOverlap[mode]; | 64 return kTabstripTabOverlap[mode]; |
58 case TABSTRIP_TOOLBAR_OVERLAP: | 65 case TABSTRIP_TOOLBAR_OVERLAP: |
59 return kTabstripToolbarOverlap[mode]; | 66 return kTabstripToolbarOverlap[mode]; |
60 case TAB_CLOSE_BUTTON_TRAILING_PADDING_OVERLAP: | 67 case TAB_CLOSE_BUTTON_TRAILING_PADDING_OVERLAP: |
61 return kTabCloseButtonTrailingPaddingOverlap[mode]; | 68 return kTabCloseButtonTrailingPaddingOverlap[mode]; |
62 case TAB_FAVICON_TITLE_SPACING: | 69 case TAB_FAVICON_TITLE_SPACING: |
63 return kTabFaviconTitleSpacing[mode]; | 70 return kTabFaviconTitleSpacing[mode]; |
64 case TAB_MAXIMUM_TITLE_WIDTH: | 71 case TAB_MAXIMUM_TITLE_WIDTH: |
65 return kTabMaximumTitleWidth[mode]; | 72 return kTabMaximumTitleWidth[mode]; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 kToolbarBottomPadding[mode], | 125 kToolbarBottomPadding[mode], |
119 kToolbarRightPadding[mode]); | 126 kToolbarRightPadding[mode]); |
120 case TOOLBAR_BUTTON: { | 127 case TOOLBAR_BUTTON: { |
121 const int inset = kToolbarButtonPadding[mode]; | 128 const int inset = kToolbarButtonPadding[mode]; |
122 return gfx::Insets(inset, inset, inset, inset); | 129 return gfx::Insets(inset, inset, inset, inset); |
123 } | 130 } |
124 } | 131 } |
125 NOTREACHED(); | 132 NOTREACHED(); |
126 return gfx::Insets(); | 133 return gfx::Insets(); |
127 } | 134 } |
OLD | NEW |