Commit 422cb036 authored by Tetsui Ohkubo's avatar Tetsui Ohkubo Committed by Commit Bot

Unified: disable date button when unavailable.

This CL disables date time settings button when WebUI settings and
date time dialog are unavailable. For example, it will not be included
in focus traversal on lock screen.

TEST=manual
BUG=860222

Change-Id: I54e4f1188596413fdfe0a4d826fbcec8cae85b6a
Reviewed-on: https://chromium-review.googlesource.com/1177463Reviewed-by: default avatarYoshiki Iguchi <yoshiki@chromium.org>
Commit-Queue: Tetsui Ohkubo <tetsui@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583993}
parent 409b9c00
...@@ -38,11 +38,16 @@ void ClockModel::SetUse24HourClock(bool use_24_hour) { ...@@ -38,11 +38,16 @@ void ClockModel::SetUse24HourClock(bool use_24_hour) {
NotifyDateFormatChanged(); NotifyDateFormatChanged();
} }
bool ClockModel::IsLoggedIn() { bool ClockModel::IsLoggedIn() const {
return Shell::Get()->session_controller()->login_status() != return Shell::Get()->session_controller()->login_status() !=
LoginStatus::NOT_LOGGED_IN; LoginStatus::NOT_LOGGED_IN;
} }
bool ClockModel::IsSettingsAvailable() const {
return Shell::Get()->session_controller()->ShouldEnableSettings() ||
can_set_time();
}
void ClockModel::ShowDateSettings() { void ClockModel::ShowDateSettings() {
Shell::Get()->system_tray_model()->client_ptr()->ShowDateSettings(); Shell::Get()->system_tray_model()->client_ptr()->ShowDateSettings();
} }
......
...@@ -28,7 +28,10 @@ class ClockModel : public chromeos::SystemClockClient::Observer, ...@@ -28,7 +28,10 @@ class ClockModel : public chromeos::SystemClockClient::Observer,
void SetUse24HourClock(bool use_24_hour); void SetUse24HourClock(bool use_24_hour);
// Return true if the session is logged in. // Return true if the session is logged in.
bool IsLoggedIn(); bool IsLoggedIn() const;
// Return true if Web UI date time settings or time dialog is available.
bool IsSettingsAvailable() const;
void ShowDateSettings(); void ShowDateSettings();
void ShowSetTimeDialog(); void ShowSetTimeDialog();
...@@ -46,7 +49,7 @@ class ClockModel : public chromeos::SystemClockClient::Observer, ...@@ -46,7 +49,7 @@ class ClockModel : public chromeos::SystemClockClient::Observer,
base::HourClockType hour_clock_type() const { return hour_clock_type_; } base::HourClockType hour_clock_type() const { return hour_clock_type_; }
bool can_set_time() { return can_set_time_; } bool can_set_time() const { return can_set_time_; }
private: private:
void NotifyDateFormatChanged(); void NotifyDateFormatChanged();
......
...@@ -94,6 +94,8 @@ DateView::DateView(UnifiedSystemTrayController* controller) ...@@ -94,6 +94,8 @@ DateView::DateView(UnifiedSystemTrayController* controller)
Shell::Get()->system_tray_model()->clock()->AddObserver(this); Shell::Get()->system_tray_model()->clock()->AddObserver(this);
TrayPopupUtils::ConfigureTrayPopupButton(this); TrayPopupUtils::ConfigureTrayPopupButton(this);
SetEnabled(Shell::Get()->system_tray_model()->clock()->IsSettingsAvailable());
} }
DateView::~DateView() { DateView::~DateView() {
......
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