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
3 // found in the LICENSE file.
5 #include "ash/system/chromeos/system_clock_observer.h"
8 #include "ash/system/tray/system_tray_notifier.h"
9 #include "chromeos/dbus/dbus_thread_manager.h"
13 SystemClockObserver::SystemClockObserver() {
14 chromeos::DBusThreadManager::Get()->GetSystemClockClient()
16 chromeos::system::TimezoneSettings::GetInstance()->AddObserver(this);
18 chromeos::DBusThreadManager::Get()->GetSystemClockClient()->CanSetTime();
21 SystemClockObserver::~SystemClockObserver() {
22 chromeos::DBusThreadManager::Get()->GetSystemClockClient()
23 ->RemoveObserver(this);
24 chromeos::system::TimezoneSettings::GetInstance()->RemoveObserver(this);
27 void SystemClockObserver::SystemClockUpdated() {
28 Shell::GetInstance()->system_tray_notifier()->NotifySystemClockTimeUpdated();
31 void SystemClockObserver::SystemClockCanSetTimeChanged(bool can_set_time
) {
32 can_set_time_
= can_set_time
;
33 Shell::GetInstance()->system_tray_notifier()
34 ->NotifySystemClockCanSetTimeChanged(can_set_time_
);
37 void SystemClockObserver::TimezoneChanged(const icu::TimeZone
& timezone
) {
38 Shell::GetInstance()->system_tray_notifier()->NotifyRefreshClock();