Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Side by Side Diff: ash/common/system/tray/tray_constants.cc

Issue 2439093002: Reland of "Added common layout framework for system menu rows." (Closed)
Patch Set: Addressed review comments. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 const int kSeparatorWidth = 1; 90 const int kSeparatorWidth = 1;
91 91
92 const SkColor kHorizontalSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F); 92 const SkColor kHorizontalSeparatorColor = SkColorSetA(SK_ColorBLACK, 0x1F);
93 const int kHorizontalSeparatorHeight = 24; 93 const int kHorizontalSeparatorHeight = 24;
94 94
95 int GetTrayConstant(TrayConstant constant) { 95 int GetTrayConstant(TrayConstant constant) {
96 const int kTrayItemHeightLegacy[] = {38, 38, kTrayItemSize}; 96 const int kTrayItemHeightLegacy[] = {38, 38, kTrayItemSize};
97 const int kTraySpacing[] = {4, 4, 0}; 97 const int kTraySpacing[] = {4, 4, 0};
98 const int kTrayPaddingFromEdgeOfShelf[] = {3, 3, 4}; 98 const int kTrayPaddingFromEdgeOfShelf[] = {3, 3, 4};
99 const int kTrayPopupItemHeight[] = {46, 46, 48}; 99 const int kTrayPopupItemHeight[] = {46, 46, 48};
100 // TODO(bruthig): Use the correct values for non-material design.
101 const int kTrayPopupItemLeftInset[] = {0, 0, 4};
102 // TODO(bruthig): Use the correct values for non-material design.
103 const int kTrayPopupItemRightInset[] = {0, 0, 4};
104 // TODO(bruthig): Use the correct values for non-material design.
105 const int kTrayPopupItemMinStartWidth[] = {48, 48, 48};
106 // TODO(bruthig): Use the correct values for non-material design.
107 const int kTrayPopupItemMinEndWidth[] = {48, 48, 48};
100 const int kVirtualKeyboardButtonSize[] = {39, 39, kTrayItemSize}; 108 const int kVirtualKeyboardButtonSize[] = {39, 39, kTrayItemSize};
101 const int kTrayImeMenuIcon[] = {40, 40, kTrayItemSize}; 109 const int kTrayImeMenuIcon[] = {40, 40, kTrayItemSize};
102 const int kTrayImageItemPadding[] = {1, 1, 3}; 110 const int kTrayImageItemPadding[] = {1, 1, 3};
103 111
104 const int mode = MaterialDesignController::GetMode(); 112 const int mode = MaterialDesignController::GetMode();
105 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && 113 DCHECK(mode >= MaterialDesignController::NON_MATERIAL &&
106 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); 114 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL);
107 115
108 switch (constant) { 116 switch (constant) {
109 case TRAY_ITEM_HEIGHT_LEGACY: 117 case TRAY_ITEM_HEIGHT_LEGACY:
110 return kTrayItemHeightLegacy[mode]; 118 return kTrayItemHeightLegacy[mode];
111 case TRAY_SPACING: 119 case TRAY_SPACING:
112 return kTraySpacing[mode]; 120 return kTraySpacing[mode];
113 case TRAY_PADDING_FROM_EDGE_OF_SHELF: 121 case TRAY_PADDING_FROM_EDGE_OF_SHELF:
114 return kTrayPaddingFromEdgeOfShelf[mode]; 122 return kTrayPaddingFromEdgeOfShelf[mode];
115 case TRAY_POPUP_ITEM_HEIGHT: 123 case TRAY_POPUP_ITEM_HEIGHT:
116 return kTrayPopupItemHeight[mode]; 124 return kTrayPopupItemHeight[mode];
125 case TRAY_POPUP_ITEM_LEFT_INSET:
126 return kTrayPopupItemLeftInset[mode];
127 case TRAY_POPUP_ITEM_RIGHT_INSET:
128 return kTrayPopupItemRightInset[mode];
129 case TRAY_POPUP_ITEM_MIN_START_WIDTH:
130 return kTrayPopupItemMinStartWidth[mode];
131 case TRAY_POPUP_ITEM_MIN_END_WIDTH:
132 return kTrayPopupItemMinEndWidth[mode];
117 case VIRTUAL_KEYBOARD_BUTTON_SIZE: 133 case VIRTUAL_KEYBOARD_BUTTON_SIZE:
118 return kVirtualKeyboardButtonSize[mode]; 134 return kVirtualKeyboardButtonSize[mode];
119 case TRAY_IME_MENU_ICON: 135 case TRAY_IME_MENU_ICON:
120 return kTrayImeMenuIcon[mode]; 136 return kTrayImeMenuIcon[mode];
121 case TRAY_IMAGE_ITEM_PADDING: 137 case TRAY_IMAGE_ITEM_PADDING:
122 return kTrayImageItemPadding[mode]; 138 return kTrayImageItemPadding[mode];
123 } 139 }
124 NOTREACHED(); 140 NOTREACHED();
125 return 0; 141 return 0;
126 } 142 }
127 143
128 } // namespace ash 144 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/tray/tray_constants.h ('k') | ash/common/system/tray/tray_popup_layout_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698