OLD | NEW |
---|---|
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/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
263 input_method::GetInputMethodManager()->AddObserver(this); | 263 input_method::GetInputMethodManager()->AddObserver(this); |
264 | 264 |
265 system::TimezoneSettings::GetInstance()->AddObserver(this); | 265 system::TimezoneSettings::GetInstance()->AddObserver(this); |
266 | 266 |
267 if (SystemKeyEventListener::GetInstance()) | 267 if (SystemKeyEventListener::GetInstance()) |
268 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); | 268 SystemKeyEventListener::GetInstance()->AddCapsLockObserver(this); |
269 | 269 |
270 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); | 270 network_icon_->SetResourceColorTheme(NetworkMenuIcon::COLOR_LIGHT); |
271 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); | 271 network_icon_dark_->SetResourceColorTheme(NetworkMenuIcon::COLOR_DARK); |
272 | 272 |
273 bluetooth_adapter_ = device::BluetoothAdapterFactory::DefaultAdapter(); | 273 device::BluetoothAdapterFactory::RunCallbackOnAdapterReady( |
274 base::Bind(&SystemTrayDelegate::InitializeOnAdapterReady, | |
275 base::Unretained(this))); | |
276 } | |
277 | |
278 bool InitializeOnAdapterReady( | |
279 scoped_refptr<device::BluetoothAdapter> adapter) { | |
bryeung
2013/01/09 15:28:02
should CHECK adapter here
youngki
2013/01/09 19:32:24
Done.
| |
280 bluetooth_adapter_ = adapter; | |
274 bluetooth_adapter_->AddObserver(this); | 281 bluetooth_adapter_->AddObserver(this); |
275 | 282 |
276 local_state_registrar_.Init(g_browser_process->local_state()); | 283 local_state_registrar_.Init(g_browser_process->local_state()); |
277 | 284 |
278 UpdateSessionStartTime(); | 285 UpdateSessionStartTime(); |
279 UpdateSessionLengthLimit(); | 286 UpdateSessionLengthLimit(); |
280 | 287 |
281 local_state_registrar_.Add( | 288 local_state_registrar_.Add( |
282 prefs::kSessionStartTime, | 289 prefs::kSessionStartTime, |
283 base::Bind(&SystemTrayDelegate::UpdateSessionStartTime, | 290 base::Bind(&SystemTrayDelegate::UpdateSessionStartTime, |
284 base::Unretained(this))); | 291 base::Unretained(this))); |
285 local_state_registrar_.Add( | 292 local_state_registrar_.Add( |
286 prefs::kSessionLengthLimit, | 293 prefs::kSessionLengthLimit, |
287 base::Bind(&SystemTrayDelegate::UpdateSessionLengthLimit, | 294 base::Bind(&SystemTrayDelegate::UpdateSessionLengthLimit, |
288 base::Unretained(this))); | 295 base::Unretained(this))); |
289 | 296 |
290 policy::BrowserPolicyConnector* policy_connector = | 297 policy::BrowserPolicyConnector* policy_connector = |
291 g_browser_process->browser_policy_connector(); | 298 g_browser_process->browser_policy_connector(); |
292 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = | 299 policy::DeviceCloudPolicyManagerChromeOS* policy_manager = |
293 policy_connector->GetDeviceCloudPolicyManager(); | 300 policy_connector->GetDeviceCloudPolicyManager(); |
294 if (policy_manager) | 301 if (policy_manager) |
295 policy_manager->core()->store()->AddObserver(this); | 302 policy_manager->core()->store()->AddObserver(this); |
296 UpdateEnterpriseDomain(); | 303 UpdateEnterpriseDomain(); |
304 | |
305 return true; | |
297 } | 306 } |
298 | 307 |
299 virtual ~SystemTrayDelegate() { | 308 virtual ~SystemTrayDelegate() { |
300 AudioHandler* audiohandler = AudioHandler::GetInstance(); | 309 AudioHandler* audiohandler = AudioHandler::GetInstance(); |
301 if (audiohandler) | 310 if (audiohandler) |
302 audiohandler->RemoveVolumeObserver(this); | 311 audiohandler->RemoveVolumeObserver(this); |
303 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); | 312 DBusThreadManager::Get()->GetSessionManagerClient()->RemoveObserver(this); |
304 DBusThreadManager::Get()->GetRootPowerManagerClient()->RemoveObserver(this); | 313 DBusThreadManager::Get()->GetRootPowerManagerClient()->RemoveObserver(this); |
305 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 314 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
306 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); | 315 NetworkLibrary* crosnet = CrosLibrary::Get()->GetNetworkLibrary(); |
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1399 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); | 1408 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegate); |
1400 }; | 1409 }; |
1401 | 1410 |
1402 } // namespace | 1411 } // namespace |
1403 | 1412 |
1404 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { | 1413 ash::SystemTrayDelegate* CreateSystemTrayDelegate() { |
1405 return new chromeos::SystemTrayDelegate(); | 1414 return new chromeos::SystemTrayDelegate(); |
1406 } | 1415 } |
1407 | 1416 |
1408 } // namespace chromeos | 1417 } // namespace chromeos |
OLD | NEW |