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 | 10 |
11 namespace ash { | 11 namespace ash { |
12 | 12 |
13 const int kPaddingFromRightEdgeOfScreenBottomAlignment = 7; | 13 const int kPaddingFromRightEdgeOfScreenBottomAlignment = 7; |
14 const int kPaddingFromBottomOfScreenBottomAlignment = 7; | 14 const int kPaddingFromBottomOfScreenBottomAlignment = 7; |
15 const int kPaddingFromOuterEdgeOfLauncherVerticalAlignment = 8; | 15 const int kPaddingFromOuterEdgeOfLauncherVerticalAlignment = 8; |
16 const int kPaddingFromInnerEdgeOfLauncherVerticalAlignment = 9; | 16 const int kPaddingFromInnerEdgeOfLauncherVerticalAlignment = 9; |
17 const int kPaddingFromBottomOfScreenVerticalAlignment = 10; | 17 const int kPaddingFromBottomOfScreenVerticalAlignment = 10; |
18 | 18 |
19 // Padding used to position the system menu relative to the status area. | 19 // Padding used to position the system menu relative to the status area. |
20 const int kBubblePaddingHorizontalBottom = 6; | 20 const int kBubblePaddingHorizontalBottom = 6; |
21 const int kBubblePaddingHorizontalSide = 10; | 21 const int kBubblePaddingHorizontalSide = 10; |
22 const int kBubblePaddingVerticalBottom = 3; | 22 const int kBubblePaddingVerticalBottom = 3; |
23 const int kBubblePaddingVerticalSide = 15; | 23 const int kBubblePaddingVerticalSide = 15; |
24 | 24 |
25 // Padding used to adjust the size of status tray dark background. | |
26 const int kAdjustBackgroundPadding = 3; | |
27 | |
28 // Top inset of system tray bubble for bottom anchor alignment. | 25 // Top inset of system tray bubble for bottom anchor alignment. |
29 const int kTrayBubbleAnchorTopInsetBottomAnchor = 3; | 26 const int kTrayBubbleAnchorTopInsetBottomAnchor = 3; |
30 | 27 |
31 const int kTrayImageItemHorizontalPaddingBottomAlignment = 1; | 28 const int kTrayImageItemHorizontalPaddingBottomAlignment = 1; |
32 const int kTrayImageItemHorizontalPaddingVerticalAlignment = 1; | 29 const int kTrayImageItemHorizontalPaddingVerticalAlignment = 1; |
33 const int kTrayImageItemVerticalPaddingVerticalAlignment = 1; | 30 const int kTrayImageItemVerticalPaddingVerticalAlignment = 1; |
34 | 31 |
35 // Size of tray items on the primary axis. | 32 // Size of tray items on the primary axis. |
36 const int kTrayItemSize = 32; | 33 const int kTrayItemSize = 32; |
37 | 34 |
38 const int kTrayLabelItemHorizontalPaddingBottomAlignment = 7; | 35 const int kTrayLabelItemHorizontalPaddingBottomAlignment = 7; |
39 | 36 |
40 // Vertical padding between status tray items when the shelf is vertical. | 37 // Vertical padding between status tray items when the shelf is vertical. |
41 const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4; | 38 const int kTrayLabelItemVerticalPaddingVerticalAlignment = 4; |
42 | 39 |
43 const int kTrayMenuBottomRowPadding = 5; | 40 const int kTrayMenuBottomRowPadding = 5; |
44 const int kTrayMenuBottomRowPaddingBetweenItems = -1; | 41 const int kTrayMenuBottomRowPaddingBetweenItems = -1; |
45 | 42 |
46 const int kTrayPopupAutoCloseDelayInSeconds = 2; | 43 const int kTrayPopupAutoCloseDelayInSeconds = 2; |
47 const int kTrayPopupAutoCloseDelayForTextInSeconds = 5; | 44 const int kTrayPopupAutoCloseDelayForTextInSeconds = 5; |
48 const int kTrayPopupPaddingHorizontal = 18; | 45 const int kTrayPopupPaddingHorizontal = 18; |
49 const int kTrayPopupPaddingBetweenItems = 10; | 46 const int kTrayPopupPaddingBetweenItems = 10; |
50 const int kTrayPopupTextSpacingVertical = 4; | 47 const int kTrayPopupTextSpacingVertical = 4; |
51 const int kTrayPopupUserCardVerticalPadding = 10; | 48 const int kTrayPopupUserCardVerticalPadding = 10; |
52 | 49 |
| 50 const int kTrayPopupItemHeight = 46; |
53 const int kTrayPopupDetailsIconWidth = 25; | 51 const int kTrayPopupDetailsIconWidth = 25; |
54 const int kTrayPopupDetailsLabelExtraLeftMargin = 8; | 52 const int kTrayPopupDetailsLabelExtraLeftMargin = 8; |
55 const SkColor kTrayPopupHoverBackgroundColor = SkColorSetRGB(0xe4, 0xe4, 0xe4); | 53 const SkColor kTrayPopupHoverBackgroundColor = SkColorSetRGB(0xe4, 0xe4, 0xe4); |
56 const int kTrayPopupScrollSeparatorHeight = 15; | 54 const int kTrayPopupScrollSeparatorHeight = 15; |
57 const int kTrayRoundedBorderRadius = 2; | 55 const int kTrayRoundedBorderRadius = 2; |
58 const int kTrayBarButtonWidth = 39; | |
59 | 56 |
60 const SkColor kBackgroundColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); | 57 const SkColor kBackgroundColor = SkColorSetRGB(0xfe, 0xfe, 0xfe); |
61 const SkColor kHoverBackgroundColor = SkColorSetRGB(0xf3, 0xf3, 0xf3); | 58 const SkColor kHoverBackgroundColor = SkColorSetRGB(0xf3, 0xf3, 0xf3); |
62 const SkColor kPublicAccountBackgroundColor = SkColorSetRGB(0xf8, 0xe5, 0xb6); | 59 const SkColor kPublicAccountBackgroundColor = SkColorSetRGB(0xf8, 0xe5, 0xb6); |
63 const SkColor kPublicAccountUserCardTextColor = SkColorSetRGB(0x66, 0x66, 0x66); | 60 const SkColor kPublicAccountUserCardTextColor = SkColorSetRGB(0x66, 0x66, 0x66); |
64 const SkColor kPublicAccountUserCardNameColor = SK_ColorBLACK; | 61 const SkColor kPublicAccountUserCardNameColor = SK_ColorBLACK; |
65 | 62 |
66 const SkColor kHeaderBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); | 63 const SkColor kHeaderBackgroundColor = SkColorSetRGB(0xf5, 0xf5, 0xf5); |
67 | 64 |
68 const SkColor kBorderDarkColor = SkColorSetRGB(0xaa, 0xaa, 0xaa); | 65 const SkColor kBorderDarkColor = SkColorSetRGB(0xaa, 0xaa, 0xaa); |
69 const SkColor kBorderLightColor = SkColorSetRGB(0xeb, 0xeb, 0xeb); | 66 const SkColor kBorderLightColor = SkColorSetRGB(0xeb, 0xeb, 0xeb); |
70 const SkColor kButtonStrokeColor = SkColorSetRGB(0xdd, 0xdd, 0xdd); | 67 const SkColor kButtonStrokeColor = SkColorSetRGB(0xdd, 0xdd, 0xdd); |
71 | 68 |
72 const SkColor kHeaderTextColorNormal = SkColorSetARGB(0x7f, 0, 0, 0); | 69 const SkColor kHeaderTextColorNormal = SkColorSetARGB(0x7f, 0, 0, 0); |
73 const SkColor kHeaderTextColorHover = SkColorSetARGB(0xd3, 0, 0, 0); | 70 const SkColor kHeaderTextColorHover = SkColorSetARGB(0xd3, 0, 0, 0); |
74 | 71 |
75 const int kTrayPopupMinWidth = 300; | 72 const int kTrayPopupMinWidth = 300; |
76 const int kTrayPopupMaxWidth = 500; | 73 const int kTrayPopupMaxWidth = 500; |
77 const int kNotificationIconWidth = 40; | 74 const int kNotificationIconWidth = 40; |
78 const int kNotificationButtonWidth = 32; | 75 const int kNotificationButtonWidth = 32; |
79 const int kTrayNotificationContentsWidth = | 76 const int kTrayNotificationContentsWidth = |
80 kTrayPopupMinWidth - (kNotificationIconWidth + kNotificationButtonWidth + | 77 kTrayPopupMinWidth - (kNotificationIconWidth + kNotificationButtonWidth + |
81 (kTrayPopupPaddingHorizontal / 2) * 3); | 78 (kTrayPopupPaddingHorizontal / 2) * 3); |
82 | 79 |
83 const int kTrayAvatarCornerRadius = 2; | |
84 const int kTrayAvatarSize = 32; | |
85 | |
86 const int kMessageCenterBubblePadding = 4; | 80 const int kMessageCenterBubblePadding = 4; |
87 const int kShelfItemHeight = 38; | |
88 | |
89 // Items are 32 by 32 in the new Chrome OS MD requirements. | |
90 const int kShelfItemSizeMD = 32; | |
91 | 81 |
92 int GetTrayConstant(TrayConstant constant) { | 82 int GetTrayConstant(TrayConstant constant) { |
| 83 const int kTrayItemHeightLegacy[] = {38, 38, kTrayItemSize}; |
93 const int kTraySpacing[] = {4, 4, 8}; | 84 const int kTraySpacing[] = {4, 4, 8}; |
94 const int kTrayPaddingFromEdgeOfShelf[] = {3, 3, 8}; | 85 const int kTrayPaddingFromEdgeOfShelf[] = {3, 3, 8}; |
| 86 const int kVirtualKeyboardButtonSize[] = {39, 39, kTrayItemSize}; |
95 | 87 |
96 const int mode = MaterialDesignController::GetMode(); | 88 const int mode = MaterialDesignController::GetMode(); |
97 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && | 89 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && |
98 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); | 90 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); |
99 | 91 |
100 switch (constant) { | 92 switch (constant) { |
| 93 case TRAY_ITEM_HEIGHT_LEGACY: |
| 94 return kTrayItemHeightLegacy[mode]; |
101 case TRAY_SPACING: | 95 case TRAY_SPACING: |
102 return kTraySpacing[mode]; | 96 return kTraySpacing[mode]; |
103 case TRAY_PADDING_FROM_EDGE_OF_SHELF: | 97 case TRAY_PADDING_FROM_EDGE_OF_SHELF: |
104 return kTrayPaddingFromEdgeOfShelf[mode]; | 98 return kTrayPaddingFromEdgeOfShelf[mode]; |
| 99 case VIRTUAL_KEYBOARD_BUTTON_SIZE: |
| 100 return kVirtualKeyboardButtonSize[mode]; |
105 } | 101 } |
106 NOTREACHED(); | 102 NOTREACHED(); |
107 return 0; | 103 return 0; |
108 } | 104 } |
109 | 105 |
110 } // namespace ash | 106 } // namespace ash |
OLD | NEW |