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/common/system/chromeos/system_clock_observer.h" | 5 #include "ash/common/system/chromeos/system_clock_observer.h" |
6 | 6 |
7 #include "ash/common/system/tray/system_tray_notifier.h" | 7 #include "ash/common/system/tray/system_tray_notifier.h" |
8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.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()->AddObserver(this); |
15 ->AddObserver(this); | |
16 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); | 15 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this); |
17 can_set_time_ = | 16 can_set_time_ = |
18 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->CanSetTime(); | 17 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->CanSetTime(); |
19 } | 18 } |
20 | 19 |
21 SystemClockObserver::~SystemClockObserver() { | 20 SystemClockObserver::~SystemClockObserver() { |
22 chromeos::DBusThreadManager::Get()->GetSystemClockClient() | 21 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver( |
23 ->RemoveObserver(this); | 22 this); |
24 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); | 23 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this); |
25 } | 24 } |
26 | 25 |
27 void SystemClockObserver::SystemClockUpdated() { | 26 void SystemClockObserver::SystemClockUpdated() { |
28 WmShell::Get()->system_tray_notifier()->NotifySystemClockTimeUpdated(); | 27 WmShell::Get()->system_tray_notifier()->NotifySystemClockTimeUpdated(); |
29 } | 28 } |
30 | 29 |
31 void SystemClockObserver::SystemClockCanSetTimeChanged(bool can_set_time) { | 30 void SystemClockObserver::SystemClockCanSetTimeChanged(bool can_set_time) { |
32 can_set_time_ = can_set_time; | 31 can_set_time_ = can_set_time; |
33 WmShell::Get()->system_tray_notifier()->NotifySystemClockCanSetTimeChanged( | 32 WmShell::Get()->system_tray_notifier()->NotifySystemClockCanSetTimeChanged( |
34 can_set_time_); | 33 can_set_time_); |
35 } | 34 } |
36 | 35 |
37 void SystemClockObserver::TimezoneChanged(const icu::TimeZone& timezone) { | 36 void SystemClockObserver::TimezoneChanged(const icu::TimeZone& timezone) { |
38 WmShell::Get()->system_tray_notifier()->NotifyRefreshClock(); | 37 WmShell::Get()->system_tray_notifier()->NotifyRefreshClock(); |
39 } | 38 } |
40 | 39 |
41 } // namespace ash | 40 } // namespace ash |
OLD | NEW |