OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "athena/system/time_view.h" | 5 #include "athena/system/time_view.h" |
6 | 6 |
7 #include "base/i18n/time_formatting.h" | 7 #include "base/i18n/time_formatting.h" |
8 #include "third_party/skia/include/core/SkColor.h" | 8 #include "third_party/skia/include/core/SkColor.h" |
9 #include "ui/views/border.h" | 9 #include "ui/views/border.h" |
10 | 10 |
11 namespace athena { | 11 namespace athena { |
12 namespace { | 12 namespace { |
13 | 13 |
14 // Amount of slop to add into the timer to make sure we're into the next minute | 14 // Amount of slop to add into the timer to make sure we're into the next minute |
15 // when the timer goes off. | 15 // when the timer goes off. |
16 const int kTimerSlopSeconds = 1; | 16 const int kTimerSlopSeconds = 1; |
17 | 17 |
18 } // namespace | 18 } // namespace |
19 | 19 |
20 TimeView::TimeView() { | 20 TimeView::TimeView(SystemUI::ColorScheme color_scheme) { |
21 SetHorizontalAlignment(gfx::ALIGN_LEFT); | 21 SetHorizontalAlignment(gfx::ALIGN_LEFT); |
22 SetEnabledColor(SK_ColorWHITE); | 22 SetEnabledColor((color_scheme == SystemUI::COLOR_SCHEME_LIGHT) |
| 23 ? SK_ColorWHITE |
| 24 : SK_ColorDKGRAY); |
23 SetAutoColorReadabilityEnabled(false); | 25 SetAutoColorReadabilityEnabled(false); |
24 SetFontList(gfx::FontList().DeriveWithStyle(gfx::Font::BOLD)); | 26 SetFontList(gfx::FontList().DeriveWithStyle(gfx::Font::BOLD)); |
| 27 SetSubpixelRenderingEnabled(false); |
25 | 28 |
26 const int kHorizontalSpacing = 10; | 29 const int kHorizontalSpacing = 10; |
27 const int kVerticalSpacing = 3; | 30 const int kVerticalSpacing = 3; |
28 SetBorder(views::Border::CreateEmptyBorder(kVerticalSpacing, | 31 SetBorder(views::Border::CreateEmptyBorder(kVerticalSpacing, |
29 kHorizontalSpacing, | 32 kHorizontalSpacing, |
30 kVerticalSpacing, | 33 kVerticalSpacing, |
31 kHorizontalSpacing)); | 34 kHorizontalSpacing)); |
32 | 35 |
33 UpdateText(); | 36 UpdateText(); |
34 } | 37 } |
(...skipping 25 matching lines...) Expand all Loading... |
60 } | 63 } |
61 | 64 |
62 void TimeView::UpdateText() { | 65 void TimeView::UpdateText() { |
63 base::Time now = base::Time::Now(); | 66 base::Time now = base::Time::Now(); |
64 SetText(base::TimeFormatTimeOfDayWithHourClockType( | 67 SetText(base::TimeFormatTimeOfDayWithHourClockType( |
65 now, base::k12HourClock, base::kKeepAmPm)); | 68 now, base::k12HourClock, base::kKeepAmPm)); |
66 SetTimer(now); | 69 SetTimer(now); |
67 } | 70 } |
68 | 71 |
69 } // namespace athena | 72 } // namespace athena |
OLD | NEW |