Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(587)

Side by Side Diff: ash/system/session_length_limit/tray_session_length_limit.cc

Issue 147443007: Add support for localized time strings with two units, eg. "2 hours 17 minutes" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More cleanup and documentation Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/session_length_limit/tray_session_length_limit.h" 5 #include "ash/system/session_length_limit/tray_session_length_limit.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/shelf/shelf_types.h" 9 #include "ash/shelf/shelf_types.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 DCHECK_LE(value, 99); 64 DCHECK_LE(value, 99);
65 if (value < 10) 65 if (value < 10)
66 return base::ASCIIToUTF16("0") + base::IntToString16(value); 66 return base::ASCIIToUTF16("0") + base::IntToString16(value);
67 return base::IntToString16(value); 67 return base::IntToString16(value);
68 } 68 }
69 69
70 base::string16 FormatRemainingSessionTimeNotification( 70 base::string16 FormatRemainingSessionTimeNotification(
71 const base::TimeDelta& remaining_session_time) { 71 const base::TimeDelta& remaining_session_time) {
72 return l10n_util::GetStringFUTF16( 72 return l10n_util::GetStringFUTF16(
73 IDS_ASH_STATUS_TRAY_REMAINING_SESSION_TIME_NOTIFICATION, 73 IDS_ASH_STATUS_TRAY_REMAINING_SESSION_TIME_NOTIFICATION,
74 ui::TimeFormat::TimeDurationLong(remaining_session_time)); 74 ui::TimeFormat::Simple(ui::TimeFormat::kDuration, ui::TimeFormat::kLong,
75 remaining_session_time));
75 } 76 }
76 77
77 // Creates, or updates the notification for session length timeout with 78 // Creates, or updates the notification for session length timeout with
78 // |remaining_time|. |state_changed| is true when its internal state has been 79 // |remaining_time|. |state_changed| is true when its internal state has been
79 // changed from another. 80 // changed from another.
80 void CreateOrUpdateNotification(const std::string& notification_id, 81 void CreateOrUpdateNotification(const std::string& notification_id,
81 const base::TimeDelta& remaining_time, 82 const base::TimeDelta& remaining_time,
82 bool state_changed) { 83 bool state_changed) {
83 message_center::MessageCenter* message_center = 84 message_center::MessageCenter* message_center =
84 message_center::MessageCenter::Get(); 85 message_center::MessageCenter::Get();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (tray_view_) 381 if (tray_view_)
381 tray_view_->Update(); 382 tray_view_->Update();
382 } 383 }
383 384
384 bool TraySessionLengthLimit::IsTrayViewVisibleForTest() { 385 bool TraySessionLengthLimit::IsTrayViewVisibleForTest() {
385 return tray_view_ && tray_view_->visible(); 386 return tray_view_ && tray_view_->visible();
386 } 387 }
387 388
388 } // namespace internal 389 } // namespace internal
389 } // namespace ash 390 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698