| 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_utils.h" | 5 #include "ash/common/system/tray/tray_utils.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 "ash/common/shelf/wm_shelf_util.h" | 8 #include "ash/common/shelf/wm_shelf_util.h" |
| 9 #include "ash/common/system/tray/tray_constants.h" | 9 #include "ash/common/system/tray/tray_constants.h" |
| 10 #include "ash/common/system/tray/tray_item_view.h" | 10 #include "ash/common/system/tray/tray_item_view.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD)); | 28 gfx::FontList().Derive(1, gfx::Font::NORMAL, gfx::Font::Weight::BOLD)); |
| 29 label->SetShadows(gfx::ShadowValues( | 29 label->SetShadows(gfx::ShadowValues( |
| 30 1, | 30 1, |
| 31 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); | 31 gfx::ShadowValue(gfx::Vector2d(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); |
| 32 label->SetAutoColorReadabilityEnabled(false); | 32 label->SetAutoColorReadabilityEnabled(false); |
| 33 label->SetEnabledColor(SK_ColorWHITE); | 33 label->SetEnabledColor(SK_ColorWHITE); |
| 34 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 34 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
| 35 } | 35 } |
| 36 } | 36 } |
| 37 | 37 |
| 38 // TODO(yiyix): Instead of using a fixed padding beside each tray item, take |
| 39 // internal icon padding into account when adjusting tray icon spacing. See |
| 40 // crbug.com/653292. |
| 38 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) { | 41 void SetTrayImageItemBorder(views::View* tray_view, ShelfAlignment alignment) { |
| 42 const int tray_image_item_padding = GetTrayConstant(TRAY_IMAGE_ITEM_PADDING); |
| 39 if (IsHorizontalAlignment(alignment)) { | 43 if (IsHorizontalAlignment(alignment)) { |
| 40 tray_view->SetBorder(views::Border::CreateEmptyBorder( | 44 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 41 0, kTrayImageItemHorizontalPaddingBottomAlignment, 0, | 45 0, tray_image_item_padding, 0, tray_image_item_padding)); |
| 42 kTrayImageItemHorizontalPaddingBottomAlignment)); | |
| 43 } else { | 46 } else { |
| 44 tray_view->SetBorder(views::Border::CreateEmptyBorder( | 47 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 45 kTrayImageItemVerticalPaddingVerticalAlignment, | 48 tray_image_item_padding, |
| 46 kTrayImageItemHorizontalPaddingVerticalAlignment, | 49 kTrayImageItemHorizontalPaddingVerticalAlignment, |
| 47 kTrayImageItemVerticalPaddingVerticalAlignment, | 50 tray_image_item_padding, |
| 48 kTrayImageItemHorizontalPaddingVerticalAlignment)); | 51 kTrayImageItemHorizontalPaddingVerticalAlignment)); |
| 49 } | 52 } |
| 50 } | 53 } |
| 51 | 54 |
| 52 void SetTrayLabelItemBorder(TrayItemView* tray_view, ShelfAlignment alignment) { | 55 void SetTrayLabelItemBorder(TrayItemView* tray_view, ShelfAlignment alignment) { |
| 53 if (IsHorizontalAlignment(alignment)) { | 56 if (IsHorizontalAlignment(alignment)) { |
| 54 tray_view->SetBorder(views::Border::CreateEmptyBorder( | 57 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 55 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0, | 58 0, kTrayLabelItemHorizontalPaddingBottomAlignment, 0, |
| 56 kTrayLabelItemHorizontalPaddingBottomAlignment)); | 59 kTrayLabelItemHorizontalPaddingBottomAlignment)); |
| 57 } else { | 60 } else { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 77 // Do not descend into static text labels which may compute their own labels | 80 // Do not descend into static text labels which may compute their own labels |
| 78 // recursively. | 81 // recursively. |
| 79 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT) | 82 if (temp_state.role == ui::AX_ROLE_STATIC_TEXT) |
| 80 return; | 83 return; |
| 81 | 84 |
| 82 for (int i = 0; i < view->child_count(); ++i) | 85 for (int i = 0; i < view->child_count(); ++i) |
| 83 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); | 86 GetAccessibleLabelFromDescendantViews(view->child_at(i), out_labels); |
| 84 } | 87 } |
| 85 | 88 |
| 86 } // namespace ash | 89 } // namespace ash |
| OLD | NEW |