Commit 1da26f5e authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Fix date click bug in UnifiedSystemTray.

When date in system tray is clicked, it should show WebUI settings when
it's available, and otherwise it should show time dialog.

This CL also fixes bug in ClockModel::IsLoggedIn and sets initial
values to avoid undefined behavior.

TEST=manual
BUG=none

Change-Id: I64eebe3632e1c02d0633e5191d136d83107f869c
Reviewed-on: https://chromium-review.googlesource.com/1111492Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569549}
parent 118b4b5a
......@@ -39,7 +39,7 @@ void ClockModel::SetUse24HourClock(bool use_24_hour) {
}
bool ClockModel::IsLoggedIn() {
return Shell::Get()->session_controller()->login_status() ==
return Shell::Get()->session_controller()->login_status() !=
LoginStatus::NOT_LOGGED_IN;
}
......
......@@ -54,10 +54,10 @@ class ClockModel : public chromeos::SystemClockClient::Observer,
void NotifySystemClockCanSetTimeChanged(bool can_set_time);
// The type of clock hour display: 12 or 24 hour.
base::HourClockType hour_clock_type_;
base::HourClockType hour_clock_type_ = base::k12HourClock;
// If system clock can be configured by user through SetTimeDialog.
bool can_set_time_;
bool can_set_time_ = false;
base::ObserverList<ClockObserver> observers_;
......
......@@ -132,11 +132,14 @@ void UnifiedSystemTrayController::HandlePowerAction() {
}
void UnifiedSystemTrayController::HandleOpenDateTimeSettingsAction() {
if (Shell::Get()->system_tray_model()->clock()->can_set_time()) {
Shell::Get()->system_tray_model()->clock()->ShowSetTimeDialog();
} else {
Shell::Get()->system_tray_model()->clock()->ShowDateSettings();
}
ClockModel* model = Shell::Get()->system_tray_model()->clock();
if (!model->can_set_time())
return;
if (Shell::Get()->session_controller()->ShouldEnableSettings())
model->ShowDateSettings();
else
model->ShowSetTimeDialog();
CloseBubble();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment