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" |
11 #include "ui/views/controls/label.h" | 11 #include "ui/views/controls/label.h" |
12 | 12 |
13 namespace ash { | 13 namespace ash { |
14 | 14 |
15 void SetupLabelForTray(views::Label* label) { | 15 void SetupLabelForTray(views::Label* label) { |
16 // Making label_font static to avoid the time penalty of Derive for all but | 16 // |font_list| is static to avoid repeated inefficient Derive calls. |
17 // the first call. | 17 static const gfx::FontList font_list( |
sky
2014/06/18 00:04:40
Style guide says no statics like this.
msw
2014/06/18 00:15:27
Hmm, for some reason I thought they were okay when
| |
18 static const gfx::FontList label_font_list( | |
19 gfx::FontList().Derive(1, gfx::Font::BOLD)); | 18 gfx::FontList().Derive(1, gfx::Font::BOLD)); |
20 label->SetFontList(label_font_list); | 19 label->SetFontList(font_list); |
21 label->SetAutoColorReadabilityEnabled(false); | 20 label->SetAutoColorReadabilityEnabled(false); |
22 label->SetEnabledColor(SK_ColorWHITE); | 21 label->SetEnabledColor(SK_ColorWHITE); |
23 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); | 22 label->SetBackgroundColor(SkColorSetARGB(0, 255, 255, 255)); |
24 label->SetShadowColors(SkColorSetARGB(64, 0, 0, 0), | 23 label->set_shadows(gfx::ShadowValues(1, |
25 SkColorSetARGB(64, 0, 0, 0)); | 24 gfx::ShadowValue(gfx::Point(0, 1), 0, SkColorSetARGB(64, 0, 0, 0)))); |
26 label->SetShadowOffset(0, 1); | |
27 } | 25 } |
28 | 26 |
29 void SetTrayImageItemBorder(views::View* tray_view, | 27 void SetTrayImageItemBorder(views::View* tray_view, |
30 ShelfAlignment alignment) { | 28 ShelfAlignment alignment) { |
31 if (alignment == SHELF_ALIGNMENT_BOTTOM || | 29 if (alignment == SHELF_ALIGNMENT_BOTTOM || |
32 alignment == SHELF_ALIGNMENT_TOP) { | 30 alignment == SHELF_ALIGNMENT_TOP) { |
33 tray_view->SetBorder(views::Border::CreateEmptyBorder( | 31 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
34 0, | 32 0, |
35 kTrayImageItemHorizontalPaddingBottomAlignment, | 33 kTrayImageItemHorizontalPaddingBottomAlignment, |
36 0, | 34 0, |
(...skipping 23 matching lines...) Expand all Loading... | |
60 tray_view->label()->GetPreferredSize().width()) / 2); | 58 tray_view->label()->GetPreferredSize().width()) / 2); |
61 tray_view->SetBorder(views::Border::CreateEmptyBorder( | 59 tray_view->SetBorder(views::Border::CreateEmptyBorder( |
62 kTrayLabelItemVerticalPaddingVerticalAlignment, | 60 kTrayLabelItemVerticalPaddingVerticalAlignment, |
63 horizontal_padding, | 61 horizontal_padding, |
64 kTrayLabelItemVerticalPaddingVerticalAlignment, | 62 kTrayLabelItemVerticalPaddingVerticalAlignment, |
65 horizontal_padding)); | 63 horizontal_padding)); |
66 } | 64 } |
67 } | 65 } |
68 | 66 |
69 } // namespace ash | 67 } // namespace ash |
OLD | NEW |