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

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: Address Tony's comments Created 6 years, 9 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::FORMAT_DURATION,
75 ui::TimeFormat::LENGTH_LONG,
76 remaining_session_time));
75 } 77 }
76 78
77 // Creates, or updates the notification for session length timeout with 79 // Creates, or updates the notification for session length timeout with
78 // |remaining_time|. |state_changed| is true when its internal state has been 80 // |remaining_time|. |state_changed| is true when its internal state has been
79 // changed from another. 81 // changed from another.
80 void CreateOrUpdateNotification(const std::string& notification_id, 82 void CreateOrUpdateNotification(const std::string& notification_id,
81 const base::TimeDelta& remaining_time, 83 const base::TimeDelta& remaining_time,
82 bool state_changed) { 84 bool state_changed) {
83 message_center::MessageCenter* message_center = 85 message_center::MessageCenter* message_center =
84 message_center::MessageCenter::Get(); 86 message_center::MessageCenter::Get();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (tray_view_) 382 if (tray_view_)
381 tray_view_->Update(); 383 tray_view_->Update();
382 } 384 }
383 385
384 bool TraySessionLengthLimit::IsTrayViewVisibleForTest() { 386 bool TraySessionLengthLimit::IsTrayViewVisibleForTest() {
385 return tray_view_ && tray_view_->visible(); 387 return tray_view_ && tray_view_->visible();
386 } 388 }
387 389
388 } // namespace internal 390 } // namespace internal
389 } // namespace ash 391 } // namespace ash
OLDNEW
« no previous file with comments | « ash/system/logout_button/logout_confirmation_dialog_view.cc ('k') | build/ios/grit_whitelist.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698