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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 const int kTabHeight[] = {29, 33}; | 22 const int kTabHeight[] = {29, 33}; |
23 const int kTabPinnedContentWidth[] = {23, 23}; | 23 const int kTabPinnedContentWidth[] = {23, 23}; |
24 const int kTabstripNewTabButtonOverlap[] = {5, 6}; | 24 const int kTabstripNewTabButtonOverlap[] = {5, 6}; |
25 const int kTabstripTabOverlap[] = {16, 16}; | 25 const int kTabstripTabOverlap[] = {16, 16}; |
26 const int kToolbarStandardSpacing[] = {4, 8}; | 26 const int kToolbarStandardSpacing[] = {4, 8}; |
27 const int kToolbarElementPadding[] = {0, 8}; | 27 const int kToolbarElementPadding[] = {0, 8}; |
28 const int kToolbarLocationBarRightPadding[] = {4, 8}; | 28 const int kToolbarLocationBarRightPadding[] = {4, 8}; |
29 | 29 |
30 const int mode = ui::MaterialDesignController::GetMode(); | 30 const int mode = ui::MaterialDesignController::GetMode(); |
31 switch (constant) { | 31 switch (constant) { |
| 32 case AVATAR_ICON_PADDING: |
| 33 return 4; |
32 case FIND_BAR_TOOLBAR_OVERLAP: | 34 case FIND_BAR_TOOLBAR_OVERLAP: |
33 return kFindBarVerticalOffset[mode]; | 35 return kFindBarVerticalOffset[mode]; |
34 case LOCATION_BAR_BORDER_THICKNESS: | 36 case LOCATION_BAR_BORDER_THICKNESS: |
35 return kLocationBarBorderThickness[mode]; | 37 return kLocationBarBorderThickness[mode]; |
36 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: | 38 case LOCATION_BAR_BUBBLE_FONT_VERTICAL_PADDING: |
37 return kLocationBarBubbleFontVerticalPadding[mode]; | 39 return kLocationBarBubbleFontVerticalPadding[mode]; |
38 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: | 40 case LOCATION_BAR_BUBBLE_VERTICAL_PADDING: |
39 return kLocationBarBubbleVerticalPadding[mode]; | 41 return kLocationBarBubbleVerticalPadding[mode]; |
40 case LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET: | 42 case LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET: |
41 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) | 43 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) |
(...skipping 10 matching lines...) Expand all Loading... |
52 case TABSTRIP_NEW_TAB_BUTTON_OVERLAP: | 54 case TABSTRIP_NEW_TAB_BUTTON_OVERLAP: |
53 return kTabstripNewTabButtonOverlap[mode]; | 55 return kTabstripNewTabButtonOverlap[mode]; |
54 case TABSTRIP_TAB_OVERLAP: | 56 case TABSTRIP_TAB_OVERLAP: |
55 return kTabstripTabOverlap[mode]; | 57 return kTabstripTabOverlap[mode]; |
56 case TAB_FAVICON_TITLE_SPACING: | 58 case TAB_FAVICON_TITLE_SPACING: |
57 return kTabFaviconTitleSpacing[mode]; | 59 return kTabFaviconTitleSpacing[mode]; |
58 case TAB_HEIGHT: | 60 case TAB_HEIGHT: |
59 return kTabHeight[mode]; | 61 return kTabHeight[mode]; |
60 case TAB_PINNED_CONTENT_WIDTH: | 62 case TAB_PINNED_CONTENT_WIDTH: |
61 return kTabPinnedContentWidth[mode]; | 63 return kTabPinnedContentWidth[mode]; |
| 64 case TOOLBAR_BUTTON_PADDING: |
| 65 return 6; |
62 case TOOLBAR_ELEMENT_PADDING: | 66 case TOOLBAR_ELEMENT_PADDING: |
63 return kToolbarElementPadding[mode]; | 67 return kToolbarElementPadding[mode]; |
64 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: | 68 case TOOLBAR_LOCATION_BAR_RIGHT_PADDING: |
65 return kToolbarLocationBarRightPadding[mode]; | 69 return kToolbarLocationBarRightPadding[mode]; |
66 case TOOLBAR_STANDARD_SPACING: | 70 case TOOLBAR_STANDARD_SPACING: |
67 return kToolbarStandardSpacing[mode]; | 71 return kToolbarStandardSpacing[mode]; |
68 } | 72 } |
69 NOTREACHED(); | 73 NOTREACHED(); |
70 return 0; | 74 return 0; |
71 } | 75 } |
72 | 76 |
73 gfx::Insets GetLayoutInsets(LayoutInset inset) { | 77 gfx::Insets GetLayoutInsets(LayoutInset inset) { |
74 const int kAvatarLeftPadding[] = {4, 4}; | |
75 const int kAvatarRightPadding[] = {4, 4}; | |
76 const int kAvatarBottomPadding[] = {4, 4}; | |
77 const int kOmniboxDropdownIconPadding[] = {4, 8}; | |
78 const int kOmniboxDropdownPadding[] = {4, 4}; | |
79 const int kOmniboxDropdownTextPadding[] = {3, 3}; | |
80 const int kTabBottomPadding[] = {1, 1}; | |
81 const int kTabHorizontalPadding[] = {16, 18}; | |
82 const int kTabTopPadding[] = {1, 1}; | |
83 const int kToolbarBottomPadding[] = {5, 5}; | |
84 const int kToolbarButtonPadding[] = {6, 6}; | |
85 const int kToolbarLeftPadding[] = {4, 8}; | |
86 const int kToolbarRightPadding[] = {4, 8}; | |
87 const int kToolbarTopPadding[] = {4, 4}; | |
88 | |
89 const int mode = ui::MaterialDesignController::GetMode(); | |
90 switch (inset) { | 78 switch (inset) { |
91 case AVATAR_ICON: | 79 case TAB: { |
92 return gfx::Insets(0, kAvatarLeftPadding[mode], | 80 const bool hybrid = ui::MaterialDesignController::GetMode() == |
93 kAvatarBottomPadding[mode], kAvatarRightPadding[mode]); | 81 ui::MaterialDesignController::MATERIAL_HYBRID; |
94 case OMNIBOX_DROPDOWN: | 82 return gfx::Insets(1, hybrid ? 18 : 16); |
95 return gfx::Insets(kOmniboxDropdownPadding[mode], 0); | 83 } |
96 case OMNIBOX_DROPDOWN_ICON: | |
97 return gfx::Insets(kOmniboxDropdownIconPadding[mode], 0); | |
98 case OMNIBOX_DROPDOWN_TEXT: | |
99 return gfx::Insets(kOmniboxDropdownTextPadding[mode], 0); | |
100 case TAB: | |
101 return gfx::Insets(kTabTopPadding[mode], kTabHorizontalPadding[mode], | |
102 kTabBottomPadding[mode], kTabHorizontalPadding[mode]); | |
103 case TOOLBAR: | |
104 return gfx::Insets(kToolbarTopPadding[mode], kToolbarLeftPadding[mode], | |
105 kToolbarBottomPadding[mode], | |
106 kToolbarRightPadding[mode]); | |
107 case TOOLBAR_BUTTON: | |
108 return gfx::Insets(kToolbarButtonPadding[mode]); | |
109 } | 84 } |
110 NOTREACHED(); | 85 NOTREACHED(); |
111 return gfx::Insets(); | 86 return gfx::Insets(); |
112 } | 87 } |
113 | 88 |
114 gfx::Size GetLayoutSize(LayoutSize size) { | 89 gfx::Size GetLayoutSize(LayoutSize size) { |
115 const int kNewTabButtonWidth[] = {36, 39}; | 90 const int kNewTabButtonWidth[] = {36, 39}; |
116 const int kNewTabButtonHeight[] = {18, 21}; | 91 const int kNewTabButtonHeight[] = {18, 21}; |
117 | 92 |
118 const int mode = ui::MaterialDesignController::GetMode(); | 93 const int mode = ui::MaterialDesignController::GetMode(); |
119 switch (size) { | 94 switch (size) { |
120 case NEW_TAB_BUTTON: | 95 case NEW_TAB_BUTTON: |
121 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); | 96 return gfx::Size(kNewTabButtonWidth[mode], kNewTabButtonHeight[mode]); |
122 } | 97 } |
123 NOTREACHED(); | 98 NOTREACHED(); |
124 return gfx::Size(); | 99 return gfx::Size(); |
125 } | 100 } |
OLD | NEW |