| 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 "chromeos/dbus/dbus_thread_manager.h" | 5 #include "chromeos/dbus/dbus_thread_manager.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "chromeos/dbus/gsm_sms_client.h" | 25 #include "chromeos/dbus/gsm_sms_client.h" |
| 26 #include "chromeos/dbus/ibus/ibus_client.h" | 26 #include "chromeos/dbus/ibus/ibus_client.h" |
| 27 #include "chromeos/dbus/image_burner_client.h" | 27 #include "chromeos/dbus/image_burner_client.h" |
| 28 #include "chromeos/dbus/introspectable_client.h" | 28 #include "chromeos/dbus/introspectable_client.h" |
| 29 #include "chromeos/dbus/modem_messaging_client.h" | 29 #include "chromeos/dbus/modem_messaging_client.h" |
| 30 #include "chromeos/dbus/nfc_adapter_client.h" | 30 #include "chromeos/dbus/nfc_adapter_client.h" |
| 31 #include "chromeos/dbus/nfc_device_client.h" | 31 #include "chromeos/dbus/nfc_device_client.h" |
| 32 #include "chromeos/dbus/nfc_manager_client.h" | 32 #include "chromeos/dbus/nfc_manager_client.h" |
| 33 #include "chromeos/dbus/nfc_tag_client.h" | 33 #include "chromeos/dbus/nfc_tag_client.h" |
| 34 #include "chromeos/dbus/permission_broker_client.h" | 34 #include "chromeos/dbus/permission_broker_client.h" |
| 35 #include "chromeos/dbus/power_data_collector.h" |
| 35 #include "chromeos/dbus/power_manager_client.h" | 36 #include "chromeos/dbus/power_manager_client.h" |
| 36 #include "chromeos/dbus/power_policy_controller.h" | 37 #include "chromeos/dbus/power_policy_controller.h" |
| 37 #include "chromeos/dbus/session_manager_client.h" | 38 #include "chromeos/dbus/session_manager_client.h" |
| 38 #include "chromeos/dbus/shill_device_client.h" | 39 #include "chromeos/dbus/shill_device_client.h" |
| 39 #include "chromeos/dbus/shill_ipconfig_client.h" | 40 #include "chromeos/dbus/shill_ipconfig_client.h" |
| 40 #include "chromeos/dbus/shill_manager_client.h" | 41 #include "chromeos/dbus/shill_manager_client.h" |
| 41 #include "chromeos/dbus/shill_profile_client.h" | 42 #include "chromeos/dbus/shill_profile_client.h" |
| 42 #include "chromeos/dbus/shill_service_client.h" | 43 #include "chromeos/dbus/shill_service_client.h" |
| 43 #include "chromeos/dbus/shill_stub_helper.h" | 44 #include "chromeos/dbus/shill_stub_helper.h" |
| 44 #include "chromeos/dbus/sms_client.h" | 45 #include "chromeos/dbus/sms_client.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 InitClient(session_manager_client_.get()); | 114 InitClient(session_manager_client_.get()); |
| 114 InitClient(sms_client_.get()); | 115 InitClient(sms_client_.get()); |
| 115 InitClient(system_clock_client_.get()); | 116 InitClient(system_clock_client_.get()); |
| 116 InitClient(update_engine_client_.get()); | 117 InitClient(update_engine_client_.get()); |
| 117 | 118 |
| 118 // PowerPolicyController is dependent on PowerManagerClient, so | 119 // PowerPolicyController is dependent on PowerManagerClient, so |
| 119 // initialize it after the main list of clients. | 120 // initialize it after the main list of clients. |
| 120 power_policy_controller_.reset( | 121 power_policy_controller_.reset( |
| 121 new PowerPolicyController(this, power_manager_client_.get())); | 122 new PowerPolicyController(this, power_manager_client_.get())); |
| 122 | 123 |
| 124 power_data_collector_.reset( |
| 125 new PowerDataCollector(power_manager_client_.get())); |
| 126 |
| 123 shill_stub_helper::SetupDefaultEnvironment(); | 127 shill_stub_helper::SetupDefaultEnvironment(); |
| 124 | 128 |
| 125 // This must be called after the list of clients so they've each had a | 129 // This must be called after the list of clients so they've each had a |
| 126 // chance to register with their object managers. | 130 // chance to register with their object managers. |
| 127 system_bus_->GetManagedObjects(); | 131 system_bus_->GetManagedObjects(); |
| 128 } | 132 } |
| 129 | 133 |
| 130 virtual ~DBusThreadManagerImpl() { | 134 virtual ~DBusThreadManagerImpl() { |
| 131 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, | 135 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, |
| 132 OnDBusThreadManagerDestroying(this)); | 136 OnDBusThreadManagerDestroying(this)); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 262 } |
| 259 | 263 |
| 260 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { | 264 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { |
| 261 return power_manager_client_.get(); | 265 return power_manager_client_.get(); |
| 262 } | 266 } |
| 263 | 267 |
| 264 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { | 268 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { |
| 265 return power_policy_controller_.get(); | 269 return power_policy_controller_.get(); |
| 266 } | 270 } |
| 267 | 271 |
| 272 virtual PowerDataCollector* GetPowerDataCollector() OVERRIDE { |
| 273 return power_data_collector_.get(); |
| 274 } |
| 275 |
| 268 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { | 276 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { |
| 269 return session_manager_client_.get(); | 277 return session_manager_client_.get(); |
| 270 } | 278 } |
| 271 | 279 |
| 272 virtual SMSClient* GetSMSClient() OVERRIDE { | 280 virtual SMSClient* GetSMSClient() OVERRIDE { |
| 273 return sms_client_.get(); | 281 return sms_client_.get(); |
| 274 } | 282 } |
| 275 | 283 |
| 276 virtual SystemClockClient* GetSystemClockClient() OVERRIDE { | 284 virtual SystemClockClient* GetSystemClockClient() OVERRIDE { |
| 277 return system_clock_client_.get(); | 285 return system_clock_client_.get(); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 scoped_ptr<NfcDeviceClient> nfc_device_client_; | 379 scoped_ptr<NfcDeviceClient> nfc_device_client_; |
| 372 scoped_ptr<NfcTagClient> nfc_tag_client_; | 380 scoped_ptr<NfcTagClient> nfc_tag_client_; |
| 373 scoped_ptr<PermissionBrokerClient> permission_broker_client_; | 381 scoped_ptr<PermissionBrokerClient> permission_broker_client_; |
| 374 scoped_ptr<SystemClockClient> system_clock_client_; | 382 scoped_ptr<SystemClockClient> system_clock_client_; |
| 375 scoped_ptr<PowerManagerClient> power_manager_client_; | 383 scoped_ptr<PowerManagerClient> power_manager_client_; |
| 376 scoped_ptr<SessionManagerClient> session_manager_client_; | 384 scoped_ptr<SessionManagerClient> session_manager_client_; |
| 377 scoped_ptr<SMSClient> sms_client_; | 385 scoped_ptr<SMSClient> sms_client_; |
| 378 scoped_ptr<UpdateEngineClient> update_engine_client_; | 386 scoped_ptr<UpdateEngineClient> update_engine_client_; |
| 379 scoped_ptr<IBusClient> ibus_client_; | 387 scoped_ptr<IBusClient> ibus_client_; |
| 380 scoped_ptr<PowerPolicyController> power_policy_controller_; | 388 scoped_ptr<PowerPolicyController> power_policy_controller_; |
| 389 scoped_ptr<PowerDataCollector> power_data_collector_; |
| 381 | 390 |
| 382 }; | 391 }; |
| 383 | 392 |
| 384 // static | 393 // static |
| 385 void DBusThreadManager::Initialize() { | 394 void DBusThreadManager::Initialize() { |
| 386 // Ignore Initialize() if we set a test DBusThreadManager. | 395 // Ignore Initialize() if we set a test DBusThreadManager. |
| 387 if (g_dbus_thread_manager_set_for_testing) | 396 if (g_dbus_thread_manager_set_for_testing) |
| 388 return; | 397 return; |
| 389 // If we initialize DBusThreadManager twice we may also be shutting it down | 398 // If we initialize DBusThreadManager twice we may also be shutting it down |
| 390 // early; do not allow that. | 399 // early; do not allow that. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 } | 473 } |
| 465 | 474 |
| 466 // static | 475 // static |
| 467 DBusThreadManager* DBusThreadManager::Get() { | 476 DBusThreadManager* DBusThreadManager::Get() { |
| 468 CHECK(g_dbus_thread_manager) | 477 CHECK(g_dbus_thread_manager) |
| 469 << "DBusThreadManager::Get() called before Initialize()"; | 478 << "DBusThreadManager::Get() called before Initialize()"; |
| 470 return g_dbus_thread_manager; | 479 return g_dbus_thread_manager; |
| 471 } | 480 } |
| 472 | 481 |
| 473 } // namespace chromeos | 482 } // namespace chromeos |
| OLD | NEW |