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

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: rebase, single quotes in browsertest js 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
« no previous file with comments | « ash/system/date/tray_date.h ('k') | ash/system/tray/default_system_tray_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8a574fed736a125d642adb023d7d7396a2ea511c 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,13 @@ 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_->can_set_time());
+#endif
return default_view_;
}
@@ -107,6 +115,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();
« no previous file with comments | « ash/system/date/tray_date.h ('k') | ash/system/tray/default_system_tray_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698