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

Side by Side Diff: ash/system/logout_button/logout_confirmation_dialog_view.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 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 "ash/system/logout_button/logout_confirmation_dialog_view.h" 5 #include "ash/system/logout_button/logout_confirmation_dialog_view.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/logout_button/logout_button_tray.h" 8 #include "ash/system/logout_button/logout_button_tray.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/system/tray/tray_constants.h" 10 #include "ash/system/tray/tray_constants.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 if (!delegate_) 116 if (!delegate_)
117 return; 117 return;
118 const base::TimeDelta time_remaining = countdown_start_time_ + 118 const base::TimeDelta time_remaining = countdown_start_time_ +
119 duration_ - delegate_->GetCurrentTime(); 119 duration_ - delegate_->GetCurrentTime();
120 // Round the remaining time to nearest second, and use this value for 120 // Round the remaining time to nearest second, and use this value for
121 // the countdown display and actual enforcement. 121 // the countdown display and actual enforcement.
122 int seconds_remaining = Round(time_remaining.InSecondsF()); 122 int seconds_remaining = Round(time_remaining.InSecondsF());
123 if (seconds_remaining > 0) { 123 if (seconds_remaining > 0) {
124 text_label_->SetText(l10n_util::GetStringFUTF16( 124 text_label_->SetText(l10n_util::GetStringFUTF16(
125 IDS_ASH_LOGOUT_CONFIRMATION_WARNING, 125 IDS_ASH_LOGOUT_CONFIRMATION_WARNING,
126 ui::TimeFormat::TimeDurationLong(base::TimeDelta::FromSeconds( 126 ui::TimeFormat::Simple(
127 seconds_remaining)))); 127 ui::TimeFormat::kDuration, ui::TimeFormat::kLong,
128 base::TimeDelta::FromSeconds(seconds_remaining))));
128 } else { 129 } else {
129 text_label_->SetText(l10n_util::GetStringUTF16( 130 text_label_->SetText(l10n_util::GetStringUTF16(
130 IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW)); 131 IDS_ASH_LOGOUT_CONFIRMATION_WARNING_NOW));
131 timer_.Stop(); 132 timer_.Stop();
132 LogoutCurrentUser(); 133 LogoutCurrentUser();
133 } 134 }
134 } 135 }
135 136
136 } // namespace internal 137 } // namespace internal
137 } // namespace ash 138 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698