| Index: ash/mus/system_tray_delegate_mus.cc
|
| diff --git a/ash/mus/system_tray_delegate_mus.cc b/ash/mus/system_tray_delegate_mus.cc
|
| index 8add535aa2bf63f0e61f51d57121d91a21396604..f2afff5527e22ea33723c2f96543ae0273b0415b 100644
|
| --- a/ash/mus/system_tray_delegate_mus.cc
|
| +++ b/ash/mus/system_tray_delegate_mus.cc
|
| @@ -6,8 +6,11 @@
|
|
|
| #include "ash/common/system/tray/system_tray_notifier.h"
|
| #include "ash/common/wm_shell.h"
|
| +#include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| #include "base/i18n/time_formatting.h"
|
| #include "base/logging.h"
|
| +#include "services/shell/public/cpp/connector.h"
|
|
|
| namespace ash {
|
| namespace {
|
| @@ -16,8 +19,9 @@ SystemTrayDelegateMus* g_instance = nullptr;
|
|
|
| } // namespace
|
|
|
| -SystemTrayDelegateMus::SystemTrayDelegateMus()
|
| - : hour_clock_type_(base::GetHourClockType()) {
|
| +SystemTrayDelegateMus::SystemTrayDelegateMus(shell::Connector* connector)
|
| + : connector_(connector), hour_clock_type_(base::GetHourClockType()) {
|
| + // Don't make an initial connection to exe:chrome. Do it on demand.
|
| DCHECK(!g_instance);
|
| g_instance = this;
|
| }
|
| @@ -32,10 +36,30 @@ SystemTrayDelegateMus* SystemTrayDelegateMus::Get() {
|
| return g_instance;
|
| }
|
|
|
| +void SystemTrayDelegateMus::ConnectToSystemTrayClient() {
|
| + if (system_tray_client_.is_bound())
|
| + return;
|
| +
|
| + connector_->ConnectToInterface("exe:chrome", &system_tray_client_);
|
| +
|
| + // Tolerate chrome crashing and coming back up.
|
| + system_tray_client_.set_connection_error_handler(base::Bind(
|
| + &SystemTrayDelegateMus::OnClientConnectionError, base::Unretained(this)));
|
| +}
|
| +
|
| +void SystemTrayDelegateMus::OnClientConnectionError() {
|
| + system_tray_client_.reset();
|
| +}
|
| +
|
| base::HourClockType SystemTrayDelegateMus::GetHourClockType() const {
|
| return hour_clock_type_;
|
| }
|
|
|
| +void SystemTrayDelegateMus::ShowDateSettings() {
|
| + ConnectToSystemTrayClient();
|
| + system_tray_client_->ShowDateSettings();
|
| +}
|
| +
|
| void SystemTrayDelegateMus::SetUse24HourClock(bool use_24_hour) {
|
| hour_clock_type_ = use_24_hour ? base::k24HourClock : base::k12HourClock;
|
| WmShell::Get()->system_tray_notifier()->NotifyDateFormatChanged();
|
|
|