OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ash/common/system/tray/tray_constants.h" | 5 #include "ash/common/system/tray/tray_constants.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
10 #include "ui/gfx/color_palette.h" | 10 #include "ui/gfx/color_palette.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 // Vertical padding between status tray items when the shelf is vertical. | 36 // Vertical padding between status tray items when the shelf is vertical. |
37 const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4; | 37 const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4; |
38 | 38 |
39 const int kTrayMenuBottomRowPadding = 5; | 39 const int kTrayMenuBottomRowPadding = 5; |
40 const int kTrayMenuBottomRowPaddingBetweenItems = -1; | 40 const int kTrayMenuBottomRowPaddingBetweenItems = -1; |
41 | 41 |
42 const int kTrayPopupAutoCloseDelayInSeconds = 2; | 42 const int kTrayPopupAutoCloseDelayInSeconds = 2; |
43 const int kTrayPopupAutoCloseDelayForTextInSeconds = 5; | 43 const int kTrayPopupAutoCloseDelayForTextInSeconds = 5; |
44 const int kTrayPopupPaddingHorizontal = 18; | 44 const int kTrayPopupPaddingHorizontal = 18; |
45 const int kTrayPopupPaddingBetweenItems = 10; | 45 const int kTrayPopupPaddingBetweenItems = 10; |
46 const int kTrayPopupTextSpacingVertical = 4; | |
47 const int kTrayPopupUserCardVerticalPadding = 10; | 46 const int kTrayPopupUserCardVerticalPadding = 10; |
| 47 const int kTrayPopupLabelHorizontalPadding = 4; |
48 const int kTrayPopupSliderPaddingMD = 16; | 48 const int kTrayPopupSliderPaddingMD = 16; |
49 | 49 |
50 const int kTrayPopupDetailsIconWidth = 25; | 50 const int kTrayPopupDetailsIconWidth = 25; |
51 const int kTrayPopupDetailsLabelExtraLeftMargin = 8; | 51 const int kTrayPopupDetailsLabelExtraLeftMargin = 8; |
52 const SkColor kTrayPopupHoverBackgroundColor = SkColorSetRGB(0xe4, 0xe4, 0xe4); | 52 const SkColor kTrayPopupHoverBackgroundColor = SkColorSetRGB(0xe4, 0xe4, 0xe4); |
53 const int kTrayPopupScrollSeparatorHeight = 15; | 53 const int kTrayPopupScrollSeparatorHeight = 15; |
54 const int kTrayRoundedBorderRadius = 2; | 54 const int kTrayRoundedBorderRadius = 2; |
55 | 55 |
56 const SkColor kBackgroundColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); | 56 const SkColor kBackgroundColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); |
57 const SkColor kHoverBackgroundColor = SkColorSetRGB(0xf3, 0xf3, 0xf3); | 57 const SkColor kHoverBackgroundColor = SkColorSetRGB(0xf3, 0xf3, 0xf3); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 const SkColor kTrayPopupInkDropBaseColor = SK_ColorBLACK; | 95 const SkColor kTrayPopupInkDropBaseColor = SK_ColorBLACK; |
96 const float kTrayPopupInkDropRippleOpacity = 0.06f; | 96 const float kTrayPopupInkDropRippleOpacity = 0.06f; |
97 const float kTrayPopupInkDropHighlightOpacity = 0.08f; | 97 const float kTrayPopupInkDropHighlightOpacity = 0.08f; |
98 const int kTrayPopupInkDropInset = 4; | 98 const int kTrayPopupInkDropInset = 4; |
99 | 99 |
100 int GetTrayConstant(TrayConstant constant) { | 100 int GetTrayConstant(TrayConstant constant) { |
101 const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize}; | 101 const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize}; |
102 const int kTraySpacing[] = {4, 0, 0}; | 102 const int kTraySpacing[] = {4, 0, 0}; |
103 const int kTrayPaddingFromEdgeOfShelf[] = {3, 4, 4}; | 103 const int kTrayPaddingFromEdgeOfShelf[] = {3, 4, 4}; |
104 const int kTrayPopupItemHeight[] = {46, 48, 48}; | 104 const int kTrayPopupItemHeight[] = {46, 48, 48}; |
105 // TODO(bruthig): Use the correct values for non-material design. | 105 // FixedSizedImageViews use the contained ImageView's width for 0 values. |
106 const int kTrayPopupItemLeftInset[] = {0, 4, 4}; | 106 const int kTrayPopupItemMainImageRegionWidth[] = {0, 48, 48}; |
107 // TODO(bruthig): Use the correct values for non-material design. | 107 // FixedSizedImageViews use the contained ImageView's width for 0 values. |
108 const int kTrayPopupItemRightInset[] = {0, 4, 4}; | 108 const int kTrayPopupItemMoreImageRegionWidth[] = {0, 20, 20}; |
109 // TODO(bruthig): Use the correct values for non-material design. | 109 const int kTrayPopupItemLeftInset[] = {0, 0, 4}; |
110 const int kTrayPopupItemMinStartWidth[] = {48, 48, 48}; | 110 const int kTrayPopupItemRightInset[] = {0, 0, 0}; |
111 // TODO(bruthig): Use the correct values for non-material design. | 111 const int kTrayPopupItemMinStartWidth[] = {46, 48, 48}; |
112 const int kTrayPopupItemMinEndWidth[] = {48, 48, 48}; | 112 const int kTrayPopupItemMinEndWidth[] = {40, 40, 40}; |
113 const int kVirtualKeyboardButtonSize[] = {39, kTrayItemSize, kTrayItemSize}; | 113 const int kVirtualKeyboardButtonSize[] = {39, kTrayItemSize, kTrayItemSize}; |
114 const int kTrayImeMenuIcon[] = {40, kTrayItemSize, kTrayItemSize}; | 114 const int kTrayImeMenuIcon[] = {40, kTrayItemSize, kTrayItemSize}; |
115 const int kTrayImageItemPadding[] = {1, 3, 3}; | 115 const int kTrayImageItemPadding[] = {1, 3, 3}; |
116 | 116 |
117 const int mode = MaterialDesignController::GetMode(); | 117 const int mode = MaterialDesignController::GetMode(); |
118 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && | 118 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && |
119 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); | 119 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); |
120 | 120 |
121 switch (constant) { | 121 switch (constant) { |
122 case TRAY_ITEM_HEIGHT_LEGACY: | 122 case TRAY_ITEM_HEIGHT_LEGACY: |
123 return kTrayItemHeightLegacy[mode]; | 123 return kTrayItemHeightLegacy[mode]; |
124 case TRAY_SPACING: | 124 case TRAY_SPACING: |
125 return kTraySpacing[mode]; | 125 return kTraySpacing[mode]; |
126 case TRAY_PADDING_FROM_EDGE_OF_SHELF: | 126 case TRAY_PADDING_FROM_EDGE_OF_SHELF: |
127 return kTrayPaddingFromEdgeOfShelf[mode]; | 127 return kTrayPaddingFromEdgeOfShelf[mode]; |
128 case TRAY_POPUP_ITEM_HEIGHT: | 128 case TRAY_POPUP_ITEM_HEIGHT: |
129 return kTrayPopupItemHeight[mode]; | 129 return kTrayPopupItemHeight[mode]; |
| 130 case TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH: |
| 131 return kTrayPopupItemMainImageRegionWidth[mode]; |
| 132 case TRAY_POPUP_ITEM_MORE_IMAGE_CONTAINER_WIDTH: |
| 133 return kTrayPopupItemMoreImageRegionWidth[mode]; |
130 case TRAY_POPUP_ITEM_LEFT_INSET: | 134 case TRAY_POPUP_ITEM_LEFT_INSET: |
131 return kTrayPopupItemLeftInset[mode]; | 135 return kTrayPopupItemLeftInset[mode]; |
132 case TRAY_POPUP_ITEM_RIGHT_INSET: | 136 case TRAY_POPUP_ITEM_RIGHT_INSET: |
133 return kTrayPopupItemRightInset[mode]; | 137 return kTrayPopupItemRightInset[mode]; |
134 case TRAY_POPUP_ITEM_MIN_START_WIDTH: | 138 case TRAY_POPUP_ITEM_MIN_START_WIDTH: |
135 return kTrayPopupItemMinStartWidth[mode]; | 139 return kTrayPopupItemMinStartWidth[mode]; |
136 case TRAY_POPUP_ITEM_MIN_END_WIDTH: | 140 case TRAY_POPUP_ITEM_MIN_END_WIDTH: |
137 return kTrayPopupItemMinEndWidth[mode]; | 141 return kTrayPopupItemMinEndWidth[mode]; |
138 case VIRTUAL_KEYBOARD_BUTTON_SIZE: | 142 case VIRTUAL_KEYBOARD_BUTTON_SIZE: |
139 return kVirtualKeyboardButtonSize[mode]; | 143 return kVirtualKeyboardButtonSize[mode]; |
140 case TRAY_IME_MENU_ICON: | 144 case TRAY_IME_MENU_ICON: |
141 return kTrayImeMenuIcon[mode]; | 145 return kTrayImeMenuIcon[mode]; |
142 case TRAY_IMAGE_ITEM_PADDING: | 146 case TRAY_IMAGE_ITEM_PADDING: |
143 return kTrayImageItemPadding[mode]; | 147 return kTrayImageItemPadding[mode]; |
144 } | 148 } |
145 NOTREACHED(); | 149 NOTREACHED(); |
146 return 0; | 150 return 0; |
147 } | 151 } |
148 | 152 |
149 } // namespace ash | 153 } // namespace ash |
OLD | NEW |