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/date/date_view.h" | 5 #include "ash/system/date/date_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/system/tray/system_tray_delegate.h" | 8 #include "ash/system/tray/system_tray_delegate.h" |
9 #include "ash/system/tray/tray_constants.h" | 9 #include "ash/system/tray/tray_constants.h" |
10 #include "ash/system/tray/tray_utils.h" | 10 #include "ash/system/tray/tray_utils.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 // Padding between the left edge of the shelf and the left edge of the vertical | 39 // Padding between the left edge of the shelf and the left edge of the vertical |
40 // clock. | 40 // clock. |
41 const int kVerticalClockLeftPadding = 9; | 41 const int kVerticalClockLeftPadding = 9; |
42 | 42 |
43 // Offset used to bring the minutes line closer to the hours line in the | 43 // Offset used to bring the minutes line closer to the hours line in the |
44 // vertical clock. | 44 // vertical clock. |
45 const int kVerticalClockMinutesTopOffset = -4; | 45 const int kVerticalClockMinutesTopOffset = -4; |
46 | 46 |
47 base::string16 FormatDate(const base::Time& time) { | 47 base::string16 FormatDate(const base::Time& time) { |
48 icu::UnicodeString date_string; | 48 icu::UnicodeString date_string; |
49 scoped_ptr<icu::DateFormat> formatter( | 49 std::unique_ptr<icu::DateFormat> formatter( |
50 icu::DateFormat::createDateInstance(icu::DateFormat::kMedium)); | 50 icu::DateFormat::createDateInstance(icu::DateFormat::kMedium)); |
51 formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string); | 51 formatter->format(static_cast<UDate>(time.ToDoubleT() * 1000), date_string); |
52 return base::string16(date_string.getBuffer(), | 52 return base::string16(date_string.getBuffer(), |
53 static_cast<size_t>(date_string.length())); | 53 static_cast<size_t>(date_string.length())); |
54 } | 54 } |
55 | 55 |
56 base::string16 FormatDayOfWeek(const base::Time& time) { | 56 base::string16 FormatDayOfWeek(const base::Time& time) { |
57 UErrorCode status = U_ZERO_ERROR; | 57 UErrorCode status = U_ZERO_ERROR; |
58 scoped_ptr<icu::DateTimePatternGenerator> generator( | 58 std::unique_ptr<icu::DateTimePatternGenerator> generator( |
59 icu::DateTimePatternGenerator::createInstance(status)); | 59 icu::DateTimePatternGenerator::createInstance(status)); |
60 DCHECK(U_SUCCESS(status)); | 60 DCHECK(U_SUCCESS(status)); |
61 const char kBasePattern[] = "EEE"; | 61 const char kBasePattern[] = "EEE"; |
62 icu::UnicodeString generated_pattern = | 62 icu::UnicodeString generated_pattern = |
63 generator->getBestPattern(icu::UnicodeString(kBasePattern), status); | 63 generator->getBestPattern(icu::UnicodeString(kBasePattern), status); |
64 DCHECK(U_SUCCESS(status)); | 64 DCHECK(U_SUCCESS(status)); |
65 icu::SimpleDateFormat simple_formatter(generated_pattern, status); | 65 icu::SimpleDateFormat simple_formatter(generated_pattern, status); |
66 DCHECK(U_SUCCESS(status)); | 66 DCHECK(U_SUCCESS(status)); |
67 icu::UnicodeString date_string; | 67 icu::UnicodeString date_string; |
68 simple_formatter.format( | 68 simple_formatter.format( |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 } | 333 } |
334 | 334 |
335 void TimeView::SetupLabel(views::Label* label) { | 335 void TimeView::SetupLabel(views::Label* label) { |
336 label->set_owned_by_client(); | 336 label->set_owned_by_client(); |
337 SetupLabelForTray(label); | 337 SetupLabelForTray(label); |
338 label->SetElideBehavior(gfx::NO_ELIDE); | 338 label->SetElideBehavior(gfx::NO_ELIDE); |
339 } | 339 } |
340 | 340 |
341 } // namespace tray | 341 } // namespace tray |
342 } // namespace ash | 342 } // namespace ash |
OLD | NEW |