Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/system/chromeos/system_clock_observer.h" | 5 #include "ash/system/chromeos/system_clock_observer.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/system/tray/system_tray_notifier.h" | 8 #include "ash/system/tray/system_tray_notifier.h" |
| 9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 SystemClockObserver::SystemClockObserver() { | 13 SystemClockObserver::SystemClockObserver() { |
| 14 chromeos::DBusThreadManager::Get()->GetSystemClockClient() | 14 chromeos::DBusThreadManager::Get()->GetSystemClockClient() |
| 15 ->AddObserver(this); | 15 ->AddObserver(this); |
| 16 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); | 16 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); |
| 17 } | 17 } |
| 18 | 18 |
| 19 SystemClockObserver::~SystemClockObserver() { | 19 SystemClockObserver::~SystemClockObserver() { |
| 20 chromeos::DBusThreadManager::Get()->GetSystemClockClient() | 20 chromeos::DBusThreadManager::Get()->GetSystemClockClient() |
| 21 ->RemoveObserver(this); | 21 ->RemoveObserver(this); |
| 22 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 22 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void SystemClockObserver::SystemClockUpdated() { | 25 void SystemClockObserver::SystemClockUpdated() { |
| 26 Shell::GetInstance()->system_tray_notifier() | 26 Shell::GetInstance()->system_tray_notifier() |
| 27 ->NotifySystemClockTimeUpdated(); | 27 ->NotifySystemClockTimeUpdated(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void SystemClockObserver::SystemClockCanSetTimeChanged(bool can_set_time) { | |
| 31 Shell::GetInstance()->system_tray_notifier() | |
| 32 ->NotifySystemClockCanSetTimeChanged(can_set_time); | |
| 33 } | |
| 34 | |
| 30 void SystemClockObserver::TimezoneChanged(const icu::TimeZone& timezone) { | 35 void SystemClockObserver::TimezoneChanged(const icu::TimeZone& timezone) { |
| 31 Shell::GetInstance()->system_tray_notifier()->NotifyRefreshClock(); | 36 Shell::GetInstance()->system_tray_notifier()->NotifyRefreshClock(); |
| 32 } | 37 } |
| 33 | 38 |
| 39 bool SystemClockObserver::SystemClockCanSetTime() { | |
| 40 return chromeos::DBusThreadManager::Get() | |
| 41 ->GetSystemClockClient()->CanSetTime(); | |
|
stevenjb
2014/04/25 22:53:31
nit: I think it would be a little nicer / more cle
michaelpg
2014/04/25 23:50:29
Done.
| |
| 42 } | |
| 43 | |
| 34 } // namespace ash | 44 } // namespace ash |
| OLD | NEW |