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 kFindBarVerticalOffset[] = {1, 6, 6}; | 11 const int kFindBarVerticalOffset[] = {1, 6, 6}; |
12 const int kIconLabelViewInternalPadding[] = {3, 2, 2}; | 12 // The -1 means the label and the icon will overlap by a pixel. |
13 const int kIconLabelViewInternalPadding[] = {3, -1, -1}; | |
14 // Unused pre-MD. | |
15 const int kIconLabelViewLeadingPadding[] = {-99, 2, 2}; | |
Peter Kasting
2015/11/07 02:36:21
If this isn't used pre-MD, then don't use LayoutCo
Evan Stade
2015/11/07 03:10:12
Done.
| |
13 const int kIconLabelViewTrailingPadding[] = {2, 8, 8}; | 16 const int kIconLabelViewTrailingPadding[] = {2, 8, 8}; |
14 const int kLocationBarBorderThickness[] = {2, 1, 1}; | 17 const int kLocationBarBorderThickness[] = {2, 1, 1}; |
15 const int kLocationBarBubbleHorizontalPadding[] = {1, 4, 4}; | 18 const int kLocationBarBubbleHorizontalPadding[] = {1, 4, 4}; |
16 const int kLocationBarBubbleVerticalPadding[] = {1, 4, 4}; | 19 const int kLocationBarBubbleVerticalPadding[] = {1, 4, 4}; |
17 const int kLocationBarHeight[] = {0, 28, 32}; | 20 const int kLocationBarHeight[] = {0, 28, 32}; |
18 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; | 21 const int kLocationBarHorizontalPadding[] = {3, 6, 6}; |
19 const int kLocationBarVerticalPadding[] = {2, 2, 2}; | 22 const int kLocationBarVerticalPadding[] = {2, 2, 2}; |
20 const int kNewTabButtonWidth[] = {34, 34, 34}; | 23 const int kNewTabButtonWidth[] = {34, 34, 34}; |
21 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; | 24 const int kOmniboxDropdownBorderInterior[] = {6, 0, 0}; |
22 const int kOmniboxFontPixelSize[] = {16, 14, 14}; | 25 const int kOmniboxFontPixelSize[] = {16, 14, 14}; |
(...skipping 16 matching lines...) Expand all Loading... | |
39 const int kToolbarElementPadding[] = {0, 0, 8}; | 42 const int kToolbarElementPadding[] = {0, 0, 8}; |
40 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; | 43 const int kToolbarLocationBarRightPadding[] = {0, 4, 8}; |
41 const int kToolbarStandardSpacing[] = {3, 4, 8}; | 44 const int kToolbarStandardSpacing[] = {3, 4, 8}; |
42 | 45 |
43 const int mode = ui::MaterialDesignController::GetMode(); | 46 const int mode = ui::MaterialDesignController::GetMode(); |
44 switch (constant) { | 47 switch (constant) { |
45 case FIND_BAR_TOOLBAR_OVERLAP: | 48 case FIND_BAR_TOOLBAR_OVERLAP: |
46 return kFindBarVerticalOffset[mode]; | 49 return kFindBarVerticalOffset[mode]; |
47 case ICON_LABEL_VIEW_INTERNAL_PADDING: | 50 case ICON_LABEL_VIEW_INTERNAL_PADDING: |
48 return kIconLabelViewInternalPadding[mode]; | 51 return kIconLabelViewInternalPadding[mode]; |
52 case ICON_LABEL_VIEW_LEADING_PADDING: | |
53 return kIconLabelViewLeadingPadding[mode]; | |
49 case ICON_LABEL_VIEW_TRAILING_PADDING: | 54 case ICON_LABEL_VIEW_TRAILING_PADDING: |
50 return kIconLabelViewTrailingPadding[mode]; | 55 return kIconLabelViewTrailingPadding[mode]; |
51 case LOCATION_BAR_BORDER_THICKNESS: | 56 case LOCATION_BAR_BORDER_THICKNESS: |
52 return kLocationBarBorderThickness[mode]; | 57 return kLocationBarBorderThickness[mode]; |
53 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: | 58 case LOCATION_BAR_BUBBLE_HORIZONTAL_PADDING: |
54 return kLocationBarBubbleHorizontalPadding[mode]; | 59 return kLocationBarBubbleHorizontalPadding[mode]; |
55 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: | 60 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: |
56 return kLocationBarBubbleVerticalPadding[mode]; | 61 return kLocationBarBubbleVerticalPadding[mode]; |
57 case LOCATION_BAR_HEIGHT: | 62 case LOCATION_BAR_HEIGHT: |
58 return kLocationBarHeight[mode]; | 63 return kLocationBarHeight[mode]; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 kToolbarBottomPadding[mode], | 145 kToolbarBottomPadding[mode], |
141 kToolbarRightPadding[mode]); | 146 kToolbarRightPadding[mode]); |
142 case TOOLBAR_BUTTON: { | 147 case TOOLBAR_BUTTON: { |
143 const int inset = kToolbarButtonPadding[mode]; | 148 const int inset = kToolbarButtonPadding[mode]; |
144 return gfx::Insets(inset, inset, inset, inset); | 149 return gfx::Insets(inset, inset, inset, inset); |
145 } | 150 } |
146 } | 151 } |
147 NOTREACHED(); | 152 NOTREACHED(); |
148 return gfx::Insets(); | 153 return gfx::Insets(); |
149 } | 154 } |
OLD | NEW |