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 15 matching lines...) Expand all Loading... |
26 #include "chromeos/dbus/shill_device_client.h" | 26 #include "chromeos/dbus/shill_device_client.h" |
27 #include "chromeos/dbus/shill_ipconfig_client.h" | 27 #include "chromeos/dbus/shill_ipconfig_client.h" |
28 #include "chromeos/dbus/shill_manager_client.h" | 28 #include "chromeos/dbus/shill_manager_client.h" |
29 #include "chromeos/dbus/shill_profile_client.h" | 29 #include "chromeos/dbus/shill_profile_client.h" |
30 #include "chromeos/dbus/shill_service_client.h" | 30 #include "chromeos/dbus/shill_service_client.h" |
31 #include "chromeos/dbus/system_clock_client.h" | 31 #include "chromeos/dbus/system_clock_client.h" |
32 #include "chromeos/dbus/ibus/ibus_client.h" | 32 #include "chromeos/dbus/ibus/ibus_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" | |
37 #include "chromeos/dbus/image_burner_client.h" | 36 #include "chromeos/dbus/image_burner_client.h" |
38 #include "chromeos/dbus/introspectable_client.h" | 37 #include "chromeos/dbus/introspectable_client.h" |
39 #include "chromeos/dbus/modem_messaging_client.h" | 38 #include "chromeos/dbus/modem_messaging_client.h" |
40 #include "chromeos/dbus/permission_broker_client.h" | 39 #include "chromeos/dbus/permission_broker_client.h" |
41 #include "chromeos/dbus/power_manager_client.h" | 40 #include "chromeos/dbus/power_manager_client.h" |
42 #include "chromeos/dbus/power_policy_controller.h" | 41 #include "chromeos/dbus/power_policy_controller.h" |
43 #include "chromeos/dbus/session_manager_client.h" | 42 #include "chromeos/dbus/session_manager_client.h" |
44 #include "chromeos/dbus/sms_client.h" | 43 #include "chromeos/dbus/sms_client.h" |
45 #include "chromeos/dbus/update_engine_client.h" | 44 #include "chromeos/dbus/update_engine_client.h" |
46 #include "dbus/bus.h" | 45 #include "dbus/bus.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 VLOG(1) << "Connected to ibus-daemon: " << ibus_address; | 178 VLOG(1) << "Connected to ibus-daemon: " << ibus_address; |
180 | 179 |
181 DBusClientImplementationType client_type = STUB_DBUS_CLIENT_IMPLEMENTATION; | 180 DBusClientImplementationType client_type = STUB_DBUS_CLIENT_IMPLEMENTATION; |
182 | 181 |
183 ibus_client_.reset( | 182 ibus_client_.reset( |
184 IBusClient::Create(client_type, ibus_bus_.get())); | 183 IBusClient::Create(client_type, ibus_bus_.get())); |
185 ibus_input_context_client_.reset( | 184 ibus_input_context_client_.reset( |
186 IBusInputContextClient::Create(client_type)); | 185 IBusInputContextClient::Create(client_type)); |
187 ibus_engine_factory_service_.reset( | 186 ibus_engine_factory_service_.reset( |
188 IBusEngineFactoryService::Create(ibus_bus_.get(), client_type)); | 187 IBusEngineFactoryService::Create(ibus_bus_.get(), client_type)); |
189 ibus_panel_service_.reset( | |
190 IBusPanelService::Create(client_type, | |
191 ibus_bus_.get(), | |
192 ibus_input_context_client_.get())); | |
193 | 188 |
194 ibus_engine_services_.clear(); | 189 ibus_engine_services_.clear(); |
195 } | 190 } |
196 | 191 |
197 // DBusThreadManager overrides: | 192 // DBusThreadManager overrides: |
198 virtual dbus::Bus* GetSystemBus() OVERRIDE { | 193 virtual dbus::Bus* GetSystemBus() OVERRIDE { |
199 return system_bus_.get(); | 194 return system_bus_.get(); |
200 } | 195 } |
201 | 196 |
202 virtual dbus::Bus* GetIBusBus() OVERRIDE { | 197 virtual dbus::Bus* GetIBusBus() OVERRIDE { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 const dbus::ObjectPath& object_path) OVERRIDE { | 327 const dbus::ObjectPath& object_path) OVERRIDE { |
333 if (ibus_engine_services_.find(object_path) != | 328 if (ibus_engine_services_.find(object_path) != |
334 ibus_engine_services_.end()) { | 329 ibus_engine_services_.end()) { |
335 LOG(WARNING) << "Object path not found: " << object_path.value(); | 330 LOG(WARNING) << "Object path not found: " << object_path.value(); |
336 return; | 331 return; |
337 } | 332 } |
338 delete ibus_engine_services_[object_path]; | 333 delete ibus_engine_services_[object_path]; |
339 ibus_engine_services_.erase(object_path); | 334 ibus_engine_services_.erase(object_path); |
340 } | 335 } |
341 | 336 |
342 virtual IBusPanelService* GetIBusPanelService() OVERRIDE { | |
343 return ibus_panel_service_.get(); | |
344 } | |
345 | |
346 private: | 337 private: |
347 // Initializes |client| with the |system_bus_|. | 338 // Initializes |client| with the |system_bus_|. |
348 void InitClient(DBusClient* client) { | 339 void InitClient(DBusClient* client) { |
349 client->Init(system_bus_.get()); | 340 client->Init(system_bus_.get()); |
350 } | 341 } |
351 | 342 |
352 // Constructs all clients -- stub or real implementation according to | 343 // Constructs all clients -- stub or real implementation according to |
353 // |client_type| and |client_type_override| -- and stores them in the | 344 // |client_type| and |client_type_override| -- and stores them in the |
354 // respective *_client_ member variable. | 345 // respective *_client_ member variable. |
355 void CreateDefaultClients(DBusClientImplementationType client_type, | 346 void CreateDefaultClients(DBusClientImplementationType client_type, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 scoped_ptr<PermissionBrokerClient> permission_broker_client_; | 409 scoped_ptr<PermissionBrokerClient> permission_broker_client_; |
419 scoped_ptr<SystemClockClient> system_clock_client_; | 410 scoped_ptr<SystemClockClient> system_clock_client_; |
420 scoped_ptr<PowerManagerClient> power_manager_client_; | 411 scoped_ptr<PowerManagerClient> power_manager_client_; |
421 scoped_ptr<SessionManagerClient> session_manager_client_; | 412 scoped_ptr<SessionManagerClient> session_manager_client_; |
422 scoped_ptr<SMSClient> sms_client_; | 413 scoped_ptr<SMSClient> sms_client_; |
423 scoped_ptr<UpdateEngineClient> update_engine_client_; | 414 scoped_ptr<UpdateEngineClient> update_engine_client_; |
424 scoped_ptr<IBusClient> ibus_client_; | 415 scoped_ptr<IBusClient> ibus_client_; |
425 scoped_ptr<IBusInputContextClient> ibus_input_context_client_; | 416 scoped_ptr<IBusInputContextClient> ibus_input_context_client_; |
426 scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; | 417 scoped_ptr<IBusEngineFactoryService> ibus_engine_factory_service_; |
427 std::map<dbus::ObjectPath, IBusEngineService*> ibus_engine_services_; | 418 std::map<dbus::ObjectPath, IBusEngineService*> ibus_engine_services_; |
428 scoped_ptr<IBusPanelService> ibus_panel_service_; | |
429 scoped_ptr<PowerPolicyController> power_policy_controller_; | 419 scoped_ptr<PowerPolicyController> power_policy_controller_; |
430 | 420 |
431 std::string ibus_address_; | 421 std::string ibus_address_; |
432 }; | 422 }; |
433 | 423 |
434 // static | 424 // static |
435 void DBusThreadManager::Initialize() { | 425 void DBusThreadManager::Initialize() { |
436 // Ignore Initialize() if we set a test DBusThreadManager. | 426 // Ignore Initialize() if we set a test DBusThreadManager. |
437 if (g_dbus_thread_manager_set_for_testing) | 427 if (g_dbus_thread_manager_set_for_testing) |
438 return; | 428 return; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 } | 504 } |
515 | 505 |
516 // static | 506 // static |
517 DBusThreadManager* DBusThreadManager::Get() { | 507 DBusThreadManager* DBusThreadManager::Get() { |
518 CHECK(g_dbus_thread_manager) | 508 CHECK(g_dbus_thread_manager) |
519 << "DBusThreadManager::Get() called before Initialize()"; | 509 << "DBusThreadManager::Get() called before Initialize()"; |
520 return g_dbus_thread_manager; | 510 return g_dbus_thread_manager; |
521 } | 511 } |
522 | 512 |
523 } // namespace chromeos | 513 } // namespace chromeos |
OLD | NEW |