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

Unified Diff: ash/system/date/tray_date.cc

Issue 247663003: Date and Time dialog for when the clock isn't synced. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Observe system clock Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: ash/system/date/tray_date.cc
diff --git a/ash/system/date/tray_date.cc b/ash/system/date/tray_date.cc
index 156d355b7bb875d72f48d34dac321696322f3fe0..a57a44f43bda4a2624d96344b9b71c1d64d96146 100644
--- a/ash/system/date/tray_date.cc
+++ b/ash/system/date/tray_date.cc
@@ -20,7 +20,8 @@ namespace ash {
TrayDate::TrayDate(SystemTray* system_tray)
: SystemTrayItem(system_tray),
time_tray_(NULL),
- default_view_(NULL) {
+ default_view_(NULL),
+ login_status_(user::LOGGED_IN_NONE) {
#if defined(OS_CHROMEOS)
system_clock_observer_.reset(new SystemClockObserver());
#endif
@@ -63,6 +64,14 @@ views::View* TrayDate::CreateTrayView(user::LoginStatus status) {
views::View* TrayDate::CreateDefaultView(user::LoginStatus status) {
default_view_ = new DateDefaultView(status);
+
+#if defined(OS_CHROMEOS)
+ // Save the login status we created the view with.
+ login_status_ = status;
+
+ OnSystemClockCanSetTimeChanged(
+ system_clock_observer_->SystemClockCanSetTime());
+#endif
return default_view_;
}
@@ -107,6 +116,15 @@ void TrayDate::OnSystemClockTimeUpdated() {
default_view_->GetDateView()->UpdateTimeFormat();
}
+void TrayDate::OnSystemClockCanSetTimeChanged(bool can_set_time) {
+ // Outside of a logged-in session, the date button should launch the set time
+ // dialog if the time can be set.
+ if (default_view_ && login_status_ == user::LOGGED_IN_NONE) {
+ default_view_->GetDateView()->SetAction(
+ can_set_time ? TrayDate::SET_SYSTEM_TIME : TrayDate::NONE);
+ }
+}
+
void TrayDate::Refresh() {
if (time_tray_)
time_tray_->UpdateText();

Powered by Google App Engine
This is Rietveld 408576698