| 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/chromeos/chromeos_version.h" | 9 #include "base/chromeos/chromeos_version.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "chromeos/dbus/ibus/ibus_config_client.h" | 32 #include "chromeos/dbus/ibus/ibus_config_client.h" |
| 33 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" | 33 #include "chromeos/dbus/ibus/ibus_engine_factory_service.h" |
| 34 #include "chromeos/dbus/ibus/ibus_engine_service.h" | 34 #include "chromeos/dbus/ibus/ibus_engine_service.h" |
| 35 #include "chromeos/dbus/ibus/ibus_input_context_client.h" | 35 #include "chromeos/dbus/ibus/ibus_input_context_client.h" |
| 36 #include "chromeos/dbus/ibus/ibus_panel_service.h" | 36 #include "chromeos/dbus/ibus/ibus_panel_service.h" |
| 37 #include "chromeos/dbus/image_burner_client.h" | 37 #include "chromeos/dbus/image_burner_client.h" |
| 38 #include "chromeos/dbus/introspectable_client.h" | 38 #include "chromeos/dbus/introspectable_client.h" |
| 39 #include "chromeos/dbus/modem_messaging_client.h" | 39 #include "chromeos/dbus/modem_messaging_client.h" |
| 40 #include "chromeos/dbus/permission_broker_client.h" | 40 #include "chromeos/dbus/permission_broker_client.h" |
| 41 #include "chromeos/dbus/power_manager_client.h" | 41 #include "chromeos/dbus/power_manager_client.h" |
| 42 #include "chromeos/dbus/power_policy_controller.h" |
| 42 #include "chromeos/dbus/session_manager_client.h" | 43 #include "chromeos/dbus/session_manager_client.h" |
| 43 #include "chromeos/dbus/sms_client.h" | 44 #include "chromeos/dbus/sms_client.h" |
| 44 #include "chromeos/dbus/speech_synthesizer_client.h" | 45 #include "chromeos/dbus/speech_synthesizer_client.h" |
| 45 #include "chromeos/dbus/update_engine_client.h" | 46 #include "chromeos/dbus/update_engine_client.h" |
| 46 #include "dbus/bus.h" | 47 #include "dbus/bus.h" |
| 47 #include "dbus/dbus_statistics.h" | 48 #include "dbus/dbus_statistics.h" |
| 48 | 49 |
| 49 namespace chromeos { | 50 namespace chromeos { |
| 50 | 51 |
| 51 static DBusThreadManager* g_dbus_thread_manager = NULL; | 52 static DBusThreadManager* g_dbus_thread_manager = NULL; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 power_manager_client_.reset( | 118 power_manager_client_.reset( |
| 118 PowerManagerClient::Create(client_type_maybe_stub, system_bus_.get())); | 119 PowerManagerClient::Create(client_type_maybe_stub, system_bus_.get())); |
| 119 session_manager_client_.reset( | 120 session_manager_client_.reset( |
| 120 SessionManagerClient::Create(client_type, system_bus_.get())); | 121 SessionManagerClient::Create(client_type, system_bus_.get())); |
| 121 sms_client_.reset( | 122 sms_client_.reset( |
| 122 SMSClient::Create(client_type, system_bus_.get())); | 123 SMSClient::Create(client_type, system_bus_.get())); |
| 123 speech_synthesizer_client_.reset( | 124 speech_synthesizer_client_.reset( |
| 124 SpeechSynthesizerClient::Create(client_type, system_bus_.get())); | 125 SpeechSynthesizerClient::Create(client_type, system_bus_.get())); |
| 125 update_engine_client_.reset( | 126 update_engine_client_.reset( |
| 126 UpdateEngineClient::Create(client_type, system_bus_.get())); | 127 UpdateEngineClient::Create(client_type, system_bus_.get())); |
| 128 |
| 129 // PowerPolicyController is dependent on PowerManagerClient, so |
| 130 // initialize it after the main list of clients. |
| 131 power_policy_controller_.reset( |
| 132 new PowerPolicyController(power_manager_client_.get())); |
| 127 } | 133 } |
| 128 | 134 |
| 129 virtual ~DBusThreadManagerImpl() { | 135 virtual ~DBusThreadManagerImpl() { |
| 130 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, | 136 FOR_EACH_OBSERVER(DBusThreadManagerObserver, observers_, |
| 131 OnDBusThreadManagerDestroying(this)); | 137 OnDBusThreadManagerDestroying(this)); |
| 132 | 138 |
| 133 // Shut down the bus. During the browser shutdown, it's ok to shut down | 139 // Shut down the bus. During the browser shutdown, it's ok to shut down |
| 134 // the bus synchronously. | 140 // the bus synchronously. |
| 135 system_bus_->ShutdownOnDBusThreadAndBlock(); | 141 system_bus_->ShutdownOnDBusThreadAndBlock(); |
| 136 if (ibus_bus_.get()) | 142 if (ibus_bus_.get()) |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 } | 280 } |
| 275 | 281 |
| 276 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE { | 282 virtual PermissionBrokerClient* GetPermissionBrokerClient() OVERRIDE { |
| 277 return permission_broker_client_.get(); | 283 return permission_broker_client_.get(); |
| 278 } | 284 } |
| 279 | 285 |
| 280 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { | 286 virtual PowerManagerClient* GetPowerManagerClient() OVERRIDE { |
| 281 return power_manager_client_.get(); | 287 return power_manager_client_.get(); |
| 282 } | 288 } |
| 283 | 289 |
| 290 virtual PowerPolicyController* GetPowerPolicyController() OVERRIDE { |
| 291 return power_policy_controller_.get(); |
| 292 } |
| 293 |
| 284 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { | 294 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { |
| 285 return session_manager_client_.get(); | 295 return session_manager_client_.get(); |
| 286 } | 296 } |
| 287 | 297 |
| 288 virtual SMSClient* GetSMSClient() OVERRIDE { | 298 virtual SMSClient* GetSMSClient() OVERRIDE { |
| 289 return sms_client_.get(); | 299 return sms_client_.get(); |
| 290 } | 300 } |
| 291 | 301 |
| 292 virtual SpeechSynthesizerClient* GetSpeechSynthesizerClient() OVERRIDE { | 302 virtual SpeechSynthesizerClient* GetSpeechSynthesizerClient() OVERRIDE { |
| 293 return speech_synthesizer_client_.get(); | 303 return speech_synthesizer_client_.get(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 scoped_ptr<SessionManagerClient> session_manager_client_; | 378 scoped_ptr<SessionManagerClient> session_manager_client_; |
| 369 scoped_ptr<SMSClient> sms_client_; | 379 scoped_ptr<SMSClient> sms_client_; |
| 370 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; | 380 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; |
| 371 scoped_ptr<UpdateEngineClient> update_engine_client_; | 381 scoped_ptr<UpdateEngineClient> update_engine_client_; |
| 372 scoped_ptr<IBusClient> ibus_client_; | 382 scoped_ptr<IBusClient> ibus_client_; |
| 373 scoped_ptr<IBusConfigClient> ibus_config_client_; | 383 scoped_ptr<IBusConfigClient> ibus_config_client_; |
| 374 scoped_ptr<IBusInputContextClient> ibus_input_context_client_; | 384 scoped_ptr<IBusInputContextClient> ibus_input_context_client_; |
| 375 scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; | 385 scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; |
| 376 std::map<dbus::ObjectPath, IBusEngineService*> ibus_engine_services_; | 386 std::map<dbus::ObjectPath, IBusEngineService*> ibus_engine_services_; |
| 377 scoped_ptr<IBusPanelService> ibus_panel_service_; | 387 scoped_ptr<IBusPanelService> ibus_panel_service_; |
| 388 scoped_ptr<PowerPolicyController> power_policy_controller_; |
| 378 | 389 |
| 379 std::string ibus_address_; | 390 std::string ibus_address_; |
| 380 | 391 |
| 381 ObserverList<DBusThreadManagerObserver> observers_; | 392 ObserverList<DBusThreadManagerObserver> observers_; |
| 382 }; | 393 }; |
| 383 | 394 |
| 384 // static | 395 // static |
| 385 void DBusThreadManager::Initialize() { | 396 void DBusThreadManager::Initialize() { |
| 386 // Ignore Initialize() if we set a test DBusThreadManager. | 397 // Ignore Initialize() if we set a test DBusThreadManager. |
| 387 if (g_dbus_thread_manager_set_for_testing) | 398 if (g_dbus_thread_manager_set_for_testing) |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 447 } | 458 } |
| 448 | 459 |
| 449 // static | 460 // static |
| 450 DBusThreadManager* DBusThreadManager::Get() { | 461 DBusThreadManager* DBusThreadManager::Get() { |
| 451 CHECK(g_dbus_thread_manager) | 462 CHECK(g_dbus_thread_manager) |
| 452 << "DBusThreadManager::Get() called before Initialize()"; | 463 << "DBusThreadManager::Get() called before Initialize()"; |
| 453 return g_dbus_thread_manager; | 464 return g_dbus_thread_manager; |
| 454 } | 465 } |
| 455 | 466 |
| 456 } // namespace chromeos | 467 } // namespace chromeos |
| OLD | NEW |