Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: chrome/browser/chromeos/system/ash_system_tray_delegate.cc

Issue 12564007: Hook up system clock update dbus signal to chrome and ash tray ui. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix MockDBusThreadManagerWithoutGMock compiling issue. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/chromeos/system/ash_system_tray_delegate.h" 5 #include "chrome/browser/chromeos/system/ash_system_tray_delegate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 #include "chrome/browser/ui/host_desktop.h" 75 #include "chrome/browser/ui/host_desktop.h"
76 #include "chrome/browser/ui/singleton_tabs.h" 76 #include "chrome/browser/ui/singleton_tabs.h"
77 #include "chrome/browser/upgrade_detector.h" 77 #include "chrome/browser/upgrade_detector.h"
78 #include "chrome/common/chrome_notification_types.h" 78 #include "chrome/common/chrome_notification_types.h"
79 #include "chrome/common/pref_names.h" 79 #include "chrome/common/pref_names.h"
80 #include "chrome/common/url_constants.h" 80 #include "chrome/common/url_constants.h"
81 #include "chromeos/chromeos_switches.h" 81 #include "chromeos/chromeos_switches.h"
82 #include "chromeos/dbus/dbus_thread_manager.h" 82 #include "chromeos/dbus/dbus_thread_manager.h"
83 #include "chromeos/dbus/power_manager_client.h" 83 #include "chromeos/dbus/power_manager_client.h"
84 #include "chromeos/dbus/session_manager_client.h" 84 #include "chromeos/dbus/session_manager_client.h"
85 #include "chromeos/dbus/system_clock_client.h"
85 #include "content/public/browser/browser_thread.h" 86 #include "content/public/browser/browser_thread.h"
86 #include "content/public/browser/notification_observer.h" 87 #include "content/public/browser/notification_observer.h"
87 #include "content/public/browser/notification_service.h" 88 #include "content/public/browser/notification_service.h"
88 #include "content/public/browser/user_metrics.h" 89 #include "content/public/browser/user_metrics.h"
89 #include "device/bluetooth/bluetooth_adapter.h" 90 #include "device/bluetooth/bluetooth_adapter.h"
90 #include "device/bluetooth/bluetooth_adapter_factory.h" 91 #include "device/bluetooth/bluetooth_adapter_factory.h"
91 #include "device/bluetooth/bluetooth_device.h" 92 #include "device/bluetooth/bluetooth_device.h"
92 #include "grit/ash_strings.h" 93 #include "grit/ash_strings.h"
93 #include "grit/generated_resources.h" 94 #include "grit/generated_resources.h"
94 #include "ui/base/l10n/l10n_util.h" 95 #include "ui/base/l10n/l10n_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 public PowerManagerClient::Observer, 191 public PowerManagerClient::Observer,
191 public SessionManagerClient::Observer, 192 public SessionManagerClient::Observer,
192 public NetworkMenuIcon::Delegate, 193 public NetworkMenuIcon::Delegate,
193 public NetworkMenu::Delegate, 194 public NetworkMenu::Delegate,
194 public NetworkLibrary::NetworkManagerObserver, 195 public NetworkLibrary::NetworkManagerObserver,
195 public NetworkLibrary::NetworkObserver, 196 public NetworkLibrary::NetworkObserver,
196 public google_apis::DriveServiceObserver, 197 public google_apis::DriveServiceObserver,
197 public content::NotificationObserver, 198 public content::NotificationObserver,
198 public input_method::InputMethodManager::Observer, 199 public input_method::InputMethodManager::Observer,
199 public system::TimezoneSettings::Observer, 200 public system::TimezoneSettings::Observer,
201 public chromeos::SystemClockClient::Observer,
200 public device::BluetoothAdapter::Observer, 202 public device::BluetoothAdapter::Observer,
201 public SystemKeyEventListener::CapsLockObserver, 203 public SystemKeyEventListener::CapsLockObserver,
202 public ash::NetworkTrayDelegate, 204 public ash::NetworkTrayDelegate,
203 public policy::CloudPolicyStore::Observer { 205 public policy::CloudPolicyStore::Observer {
204 public: 206 public:
205 SystemTrayDelegate() 207 SystemTrayDelegate()
206 : ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST( 208 : ui_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(
207 new base::WeakPtrFactory<SystemTrayDelegate>(this))), 209 new base::WeakPtrFactory<SystemTrayDelegate>(this))),
208 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST( 210 network_icon_(ALLOW_THIS_IN_INITIALIZER_LIST(
209 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))), 211 new NetworkMenuIcon(this, NetworkMenuIcon::MENU_MODE))),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 PowerManagerClient::UPDATE_INITIAL); 260 PowerManagerClient::UPDATE_INITIAL);
259 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this); 261 DBusThreadManager::Get()->GetSessionManagerClient()->AddObserver(this);
260 262
261 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); 263 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
262 crosnet->AddNetworkManagerObserver(this); 264 crosnet->AddNetworkManagerObserver(this);
263 OnNetworkManagerChanged(crosnet); 265 OnNetworkManagerChanged(crosnet);
264 266
265 input_method::GetInputMethodManager()->AddObserver(this); 267 input_method::GetInputMethodManager()->AddObserver(this);
266 268
267 system::TimezoneSettings::GetInstance()->AddObserver(this); 269 system::TimezoneSettings::GetInstance()->AddObserver(this);
270 DBusThreadManager::Get()->GetSystemClockClient()->AddObserver(this);
stevenjb 2013/03/13 17:34:31 What do you think of making TrayClock a SystemCloc
jennyz 2013/03/13 19:14:02 I am not sure if TrayDate is chromeos only, or wil
stevenjb 2013/03/13 19:22:39 So, TrayClock is already effectively chromeos spec
jennyz 2013/03/13 20:47:16 I need to jump to audio work for M27. I filed crbu
268 271
269 if (SystemKeyEventListener::GetInstance()) 272 if (SystemKeyEventListener::GetInstance())
270 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); 273 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this);
271 274
272 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); 275 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT);
273 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); 276 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK);
274 network_icon_vpn_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); 277 network_icon_vpn_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK);
275 278
276 device::BluetoothAdapterFactory::GetAdapter( 279 device::BluetoothAdapterFactory::GetAdapter(
277 base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady, 280 base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady,
(...skipping 28 matching lines...) Expand all
306 policy_manager->core()->store()->AddObserver(this); 309 policy_manager->core()->store()->AddObserver(this);
307 UpdateEnterpriseDomain(); 310 UpdateEnterpriseDomain();
308 } 311 }
309 312
310 virtual ~SystemTrayDelegate() { 313 virtual ~SystemTrayDelegate() {
311 AudioHandler* audiohandler = AudioHandler::GetInstance(); 314 AudioHandler* audiohandler = AudioHandler::GetInstance();
312 if (audiohandler) 315 if (audiohandler)
313 audiohandler->RemoveVolumeObserver(this); 316 audiohandler->RemoveVolumeObserver(this);
314 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); 317 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this);
315 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); 318 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this);
319 DBusThreadManager::Get()->GetSystemClockClient()->RemoveObserver(this);
316 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); 320 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary();
317 if (crosnet) 321 if (crosnet)
318 crosnet->RemoveNetworkManagerObserver(this); 322 crosnet->RemoveNetworkManagerObserver(this);
319 input_method::GetInputMethodManager()->RemoveObserver(this); 323 input_method::GetInputMethodManager()->RemoveObserver(this);
320 system::TimezoneSettings::GetInstance()->RemoveObserver(this); 324 system::TimezoneSettings::GetInstance()->RemoveObserver(this);
321 if (SystemKeyEventListener::GetInstance()) 325 if (SystemKeyEventListener::GetInstance())
322 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this); 326 SystemKeyEventListener::GetInstance()->RemoveCapsLockObserver(this);
323 bluetooth_adapter_->RemoveObserver(this); 327 bluetooth_adapter_->RemoveObserver(this);
324 328
325 // Stop observing gdata operations. 329 // Stop observing gdata operations.
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 DriveSystemService* FindDriveSystemService() { 1304 DriveSystemService* FindDriveSystemService() {
1301 Profile* profile = ProfileManager::GetDefaultProfile(); 1305 Profile* profile = ProfileManager::GetDefaultProfile();
1302 return DriveSystemServiceFactory::FindForProfile(profile); 1306 return DriveSystemServiceFactory::FindForProfile(profile);
1303 } 1307 }
1304 1308
1305 // Overridden from system::TimezoneSettings::Observer. 1309 // Overridden from system::TimezoneSettings::Observer.
1306 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE { 1310 virtual void TimezoneChanged(const icu::TimeZone& timezone) OVERRIDE {
1307 GetSystemTrayNotifier()->NotifyRefreshClock(); 1311 GetSystemTrayNotifier()->NotifyRefreshClock();
1308 } 1312 }
1309 1313
1314 // Overridden from SystemClockClient::Observer.
1315 virtual void SystemClockUpdated() OVERRIDE {
1316 GetSystemTrayNotifier()->NotifySystemClockTimeUpdated();
1317 }
1318
1310 // Overridden from BluetoothAdapter::Observer. 1319 // Overridden from BluetoothAdapter::Observer.
1311 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter, 1320 virtual void AdapterPresentChanged(device::BluetoothAdapter* adapter,
1312 bool present) OVERRIDE { 1321 bool present) OVERRIDE {
1313 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); 1322 GetSystemTrayNotifier()->NotifyRefreshBluetooth();
1314 } 1323 }
1315 1324
1316 virtual void AdapterPoweredChanged(device::BluetoothAdapter* adapter, 1325 virtual void AdapterPoweredChanged(device::BluetoothAdapter* adapter,
1317 bool powered) OVERRIDE { 1326 bool powered) OVERRIDE {
1318 GetSystemTrayNotifier()->NotifyRefreshBluetooth(); 1327 GetSystemTrayNotifier()->NotifyRefreshBluetooth();
1319 } 1328 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1464 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); 1473 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate);
1465 }; 1474 };
1466 1475
1467 } // namespace 1476 } // namespace
1468 1477
1469 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { 1478 ash::SystemTrayDelegate* CreateSystemTrayDelegate() {
1470 return new chromeos::SystemTrayDelegate(); 1479 return new chromeos::SystemTrayDelegate();
1471 } 1480 }
1472 1481
1473 } // namespace chromeos 1482 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698