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