| 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/system/tray/tray_utils.h" | 5 #include "ash/system/tray/tray_utils.h" |
| 6 | 6 |
| 7 #include "ash/system/tray/tray_constants.h" | 7 #include "ash/system/tray/tray_constants.h" |
| 8 #include "ash/system/tray/tray_item_view.h" | 8 #include "ash/system/tray/tray_item_view.h" |
| 9 #include "ui/gfx/font_list.h" | 9 #include "ui/gfx/font_list.h" |
| 10 #include "ui/views/border.h" | 10 #include "ui/views/border.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 24 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
| 25 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 25 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), |
| 26 SkColorSetARGB(64, 0, 0, 0)); | 26 SkColorSetARGB(64, 0, 0, 0)); |
| 27 label->SetShadowOffset(0, 1); | 27 label->SetShadowOffset(0, 1); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SetTrayImageItemBorder(views::View* tray_view, | 30 void SetTrayImageItemBorder(views::View* tray_view, |
| 31 ShelfAlignment alignment) { | 31 ShelfAlignment alignment) { |
| 32 if (alignment == SHELF_ALIGNMENT_BOTTOM || | 32 if (alignment == SHELF_ALIGNMENT_BOTTOM || |
| 33 alignment == SHELF_ALIGNMENT_TOP) { | 33 alignment == SHELF_ALIGNMENT_TOP) { |
| 34 tray_view->set_border(views::Border::CreateEmptyBorder( | 34 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 35 0, kTrayImageItemHorizontalPaddingBottomAlignment, | 35 0, |
| 36 0, kTrayImageItemHorizontalPaddingBottomAlignment)); | 36 kTrayImageItemHorizontalPaddingBottomAlignment, |
| 37 0, |
| 38 kTrayImageItemHorizontalPaddingBottomAlignment)); |
| 37 } else { | 39 } else { |
| 38 tray_view->set_border(views::Border::CreateEmptyBorder( | 40 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 39 kTrayImageItemVerticalPaddingVerticalAlignment, | 41 kTrayImageItemVerticalPaddingVerticalAlignment, |
| 40 kTrayImageItemHorizontalPaddingVerticalAlignment, | 42 kTrayImageItemHorizontalPaddingVerticalAlignment, |
| 41 kTrayImageItemVerticalPaddingVerticalAlignment, | 43 kTrayImageItemVerticalPaddingVerticalAlignment, |
| 42 kTrayImageItemHorizontalPaddingVerticalAlignment)); | 44 kTrayImageItemHorizontalPaddingVerticalAlignment)); |
| 43 } | 45 } |
| 44 } | 46 } |
| 45 | 47 |
| 46 void SetTrayLabelItemBorder(TrayItemView* tray_view, | 48 void SetTrayLabelItemBorder(TrayItemView* tray_view, |
| 47 ShelfAlignment alignment) { | 49 ShelfAlignment alignment) { |
| 48 if (alignment == SHELF_ALIGNMENT_BOTTOM || | 50 if (alignment == SHELF_ALIGNMENT_BOTTOM || |
| 49 alignment == SHELF_ALIGNMENT_TOP) { | 51 alignment == SHELF_ALIGNMENT_TOP) { |
| 50 tray_view->set_border(views::Border::CreateEmptyBorder( | 52 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 51 0, kTrayLabelItemHorizontalPaddingBottomAlignment, | 53 0, |
| 52 0, kTrayLabelItemHorizontalPaddingBottomAlignment)); | 54 kTrayLabelItemHorizontalPaddingBottomAlignment, |
| 55 0, |
| 56 kTrayLabelItemHorizontalPaddingBottomAlignment)); |
| 53 } else { | 57 } else { |
| 54 // Center the label for vertical launcher alignment. | 58 // Center the label for vertical launcher alignment. |
| 55 int horizontal_padding = std::max(0, | 59 int horizontal_padding = std::max(0, |
| 56 (tray_view->GetPreferredSize().width() - | 60 (tray_view->GetPreferredSize().width() - |
| 57 tray_view->label()->GetPreferredSize().width()) / 2); | 61 tray_view->label()->GetPreferredSize().width()) / 2); |
| 58 tray_view->set_border(views::Border::CreateEmptyBorder( | 62 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
| 59 kTrayLabelItemVerticalPaddingVerticalAlignment, | 63 kTrayLabelItemVerticalPaddingVerticalAlignment, |
| 60 horizontal_padding, | 64 horizontal_padding, |
| 61 kTrayLabelItemVerticalPaddingVerticalAlignment, | 65 kTrayLabelItemVerticalPaddingVerticalAlignment, |
| 62 horizontal_padding)); | 66 horizontal_padding)); |
| 63 } | 67 } |
| 64 } | 68 } |
| 65 | 69 |
| 66 } // namespace internal | 70 } // namespace internal |
| 67 } // namespace ash | 71 } // namespace ash |
| OLD | NEW |