Chromium Code Reviews| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 const float kTrayPopupInkDropHighlightOpacity = 0.08f; | 98 const float kTrayPopupInkDropHighlightOpacity = 0.08f; |
| 99 const int kTrayPopupInkDropInset = 4; | 99 const int kTrayPopupInkDropInset = 4; |
| 100 | 100 |
| 101 int GetTrayConstant(TrayConstant constant) { | 101 int GetTrayConstant(TrayConstant constant) { |
| 102 const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize}; | 102 const int kTrayItemHeightLegacy[] = {38, kTrayItemSize, kTrayItemSize}; |
| 103 const int kTraySpacing[] = {4, 0, 0}; | 103 const int kTraySpacing[] = {4, 0, 0}; |
| 104 const int kTrayPaddingFromEdgeOfShelf[] = {3, 4, 4}; | 104 const int kTrayPaddingFromEdgeOfShelf[] = {3, 4, 4}; |
| 105 const int kTrayPopupItemHeight[] = {46, 48, 48}; | 105 const int kTrayPopupItemHeight[] = {46, 48, 48}; |
| 106 // FixedSizedImageViews use the contained ImageView's width for 0 values. | 106 // FixedSizedImageViews use the contained ImageView's width for 0 values. |
| 107 const int kTrayPopupItemMainImageRegionWidth[] = {0, 48, 48}; | 107 const int kTrayPopupItemMainImageRegionWidth[] = {0, 48, 48}; |
| 108 // FixedSizedImageViews use the contained ImageView's width for 0 values. | 108 const int kTrayPopupItemMoreImageSize[] = {25, 20, 20}; |
|
tdanderson
2016/11/09 01:38:33
Consider using kMenuIconSize in place of the liter
bruthig
2016/11/10 02:54:54
Done.
| |
| 109 const int kTrayPopupItemMoreImageRegionWidth[] = {0, 20, 20}; | 109 const int kTrayPopupItemMoreRegionHorizontalInset[] = {10, 10, 10}; |
| 110 const int kTrayPopupItemLeftInset[] = {0, 0, 4}; | 110 const int kTrayPopupItemLeftInset[] = {0, 4, 4}; |
|
tdanderson
2016/11/09 01:38:33
Good catch
| |
| 111 const int kTrayPopupItemRightInset[] = {0, 0, 0}; | 111 const int kTrayPopupItemRightInset[] = {0, 0, 0}; |
| 112 const int kTrayPopupItemMinStartWidth[] = {46, 48, 48}; | 112 const int kTrayPopupItemMinStartWidth[] = {46, 48, 48}; |
| 113 const int kTrayPopupItemMinEndWidth[] = {40, 40, 40}; | 113 const int kTrayPopupItemMinEndWidth[] = {40, 40, 40}; |
| 114 const int kVirtualKeyboardButtonSize[] = {39, kTrayItemSize, kTrayItemSize}; | 114 const int kVirtualKeyboardButtonSize[] = {39, kTrayItemSize, kTrayItemSize}; |
| 115 const int kTrayImeMenuIcon[] = {40, kTrayItemSize, kTrayItemSize}; | 115 const int kTrayImeMenuIcon[] = {40, kTrayItemSize, kTrayItemSize}; |
| 116 const int kTrayImageItemPadding[] = {1, 3, 3}; | 116 const int kTrayImageItemPadding[] = {1, 3, 3}; |
| 117 | 117 |
| 118 const int mode = MaterialDesignController::GetMode(); | 118 const int mode = MaterialDesignController::GetMode(); |
| 119 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && | 119 DCHECK(mode >= MaterialDesignController::NON_MATERIAL && |
| 120 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); | 120 mode <= MaterialDesignController::MATERIAL_EXPERIMENTAL); |
| 121 | 121 |
| 122 switch (constant) { | 122 switch (constant) { |
| 123 case TRAY_ITEM_HEIGHT_LEGACY: | 123 case TRAY_ITEM_HEIGHT_LEGACY: |
| 124 return kTrayItemHeightLegacy[mode]; | 124 return kTrayItemHeightLegacy[mode]; |
| 125 case TRAY_SPACING: | 125 case TRAY_SPACING: |
| 126 return kTraySpacing[mode]; | 126 return kTraySpacing[mode]; |
| 127 case TRAY_PADDING_FROM_EDGE_OF_SHELF: | 127 case TRAY_PADDING_FROM_EDGE_OF_SHELF: |
| 128 return kTrayPaddingFromEdgeOfShelf[mode]; | 128 return kTrayPaddingFromEdgeOfShelf[mode]; |
| 129 case TRAY_POPUP_ITEM_HEIGHT: | 129 case TRAY_POPUP_ITEM_HEIGHT: |
| 130 return kTrayPopupItemHeight[mode]; | 130 return kTrayPopupItemHeight[mode]; |
| 131 case TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH: | 131 case TRAY_POPUP_ITEM_MAIN_IMAGE_CONTAINER_WIDTH: |
| 132 return kTrayPopupItemMainImageRegionWidth[mode]; | 132 return kTrayPopupItemMainImageRegionWidth[mode]; |
| 133 case TRAY_POPUP_ITEM_MORE_IMAGE_CONTAINER_WIDTH: | 133 case TRAY_POPUP_ITEM_MORE_IMAGE_SIZE: |
| 134 return kTrayPopupItemMoreImageRegionWidth[mode]; | 134 return kTrayPopupItemMoreImageSize[mode]; |
| 135 case TRAY_POPUP_ITEM_MORE_REGION_HORIZONTAL_INSET: | |
| 136 return kTrayPopupItemMoreRegionHorizontalInset[mode]; | |
| 135 case TRAY_POPUP_ITEM_LEFT_INSET: | 137 case TRAY_POPUP_ITEM_LEFT_INSET: |
| 136 return kTrayPopupItemLeftInset[mode]; | 138 return kTrayPopupItemLeftInset[mode]; |
| 137 case TRAY_POPUP_ITEM_RIGHT_INSET: | 139 case TRAY_POPUP_ITEM_RIGHT_INSET: |
| 138 return kTrayPopupItemRightInset[mode]; | 140 return kTrayPopupItemRightInset[mode]; |
| 139 case TRAY_POPUP_ITEM_MIN_START_WIDTH: | 141 case TRAY_POPUP_ITEM_MIN_START_WIDTH: |
| 140 return kTrayPopupItemMinStartWidth[mode]; | 142 return kTrayPopupItemMinStartWidth[mode]; |
| 141 case TRAY_POPUP_ITEM_MIN_END_WIDTH: | 143 case TRAY_POPUP_ITEM_MIN_END_WIDTH: |
| 142 return kTrayPopupItemMinEndWidth[mode]; | 144 return kTrayPopupItemMinEndWidth[mode]; |
| 143 case VIRTUAL_KEYBOARD_BUTTON_SIZE: | 145 case VIRTUAL_KEYBOARD_BUTTON_SIZE: |
| 144 return kVirtualKeyboardButtonSize[mode]; | 146 return kVirtualKeyboardButtonSize[mode]; |
| 145 case TRAY_IME_MENU_ICON: | 147 case TRAY_IME_MENU_ICON: |
| 146 return kTrayImeMenuIcon[mode]; | 148 return kTrayImeMenuIcon[mode]; |
| 147 case TRAY_IMAGE_ITEM_PADDING: | 149 case TRAY_IMAGE_ITEM_PADDING: |
| 148 return kTrayImageItemPadding[mode]; | 150 return kTrayImageItemPadding[mode]; |
| 149 } | 151 } |
| 150 NOTREACHED(); | 152 NOTREACHED(); |
| 151 return 0; | 153 return 0; |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace ash | 156 } // namespace ash |
| OLD | NEW |