OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/dbus/dbus_thread_manager.h" | 5 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "chrome/browser/chromeos/dbus/bluetooth_adapter_client.h" | 9 #include "chrome/browser/chromeos/dbus/bluetooth_adapter_client.h" |
10 #include "chrome/browser/chromeos/dbus/bluetooth_manager_client.h" | 10 #include "chrome/browser/chromeos/dbus/bluetooth_manager_client.h" |
11 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" | 11 #include "chrome/browser/chromeos/dbus/cros_dbus_service.h" |
| 12 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 13 #include "chrome/browser/chromeos/dbus/sensors_client.h" |
12 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 14 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
13 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | |
14 #include "chrome/browser/chromeos/dbus/sensors_source.h" | |
15 #include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h" | 15 #include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "dbus/bus.h" | 17 #include "dbus/bus.h" |
18 | 18 |
19 namespace chromeos { | 19 namespace chromeos { |
20 | 20 |
21 static DBusThreadManager* g_dbus_thread_manager = NULL; | 21 static DBusThreadManager* g_dbus_thread_manager = NULL; |
22 | 22 |
23 DBusThreadManager::DBusThreadManager() { | 23 DBusThreadManager::DBusThreadManager() { |
24 // Create the D-Bus thread. | 24 // Create the D-Bus thread. |
(...skipping 10 matching lines...) Expand all Loading... |
35 dbus_thread_->message_loop_proxy(); | 35 dbus_thread_->message_loop_proxy(); |
36 system_bus_ = new dbus::Bus(system_bus_options); | 36 system_bus_ = new dbus::Bus(system_bus_options); |
37 | 37 |
38 // Create and start the cros D-Bus service. | 38 // Create and start the cros D-Bus service. |
39 cros_dbus_service_ = CrosDBusService::Create(system_bus_.get()); | 39 cros_dbus_service_ = CrosDBusService::Create(system_bus_.get()); |
40 cros_dbus_service_->Start(); | 40 cros_dbus_service_->Start(); |
41 | 41 |
42 // Start monitoring sensors if needed. | 42 // Start monitoring sensors if needed. |
43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 43 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
44 if (command_line.HasSwitch(switches::kEnableSensors)) { | 44 if (command_line.HasSwitch(switches::kEnableSensors)) { |
45 sensors_source_.reset(new SensorsSource); | 45 sensors_client_.reset(SensorsClient::Create(system_bus_.get())); |
46 sensors_source_->Init(system_bus_.get()); | |
47 } | 46 } |
48 | 47 |
49 // Create bluetooth clients if bluetooth is enabled. | 48 // Create bluetooth clients if bluetooth is enabled. |
50 if (command_line.HasSwitch(switches::kEnableBluetooth)) { | 49 if (command_line.HasSwitch(switches::kEnableBluetooth)) { |
51 bluetooth_manager_client_.reset(BluetoothManagerClient::Create( | 50 bluetooth_manager_client_.reset(BluetoothManagerClient::Create( |
52 system_bus_.get())); | 51 system_bus_.get())); |
53 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create( | 52 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create( |
54 system_bus_.get())); | 53 system_bus_.get())); |
55 } | 54 } |
56 | 55 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 << "DBusThreadManager::Get() called before Initialize()"; | 102 << "DBusThreadManager::Get() called before Initialize()"; |
104 return g_dbus_thread_manager; | 103 return g_dbus_thread_manager; |
105 } | 104 } |
106 | 105 |
107 void DBusThreadManager::set_session_manager_client_for_testing( | 106 void DBusThreadManager::set_session_manager_client_for_testing( |
108 SessionManagerClient* session_manager_client) { | 107 SessionManagerClient* session_manager_client) { |
109 session_manager_client_.reset(session_manager_client); | 108 session_manager_client_.reset(session_manager_client); |
110 } | 109 } |
111 | 110 |
112 } // namespace chromeos | 111 } // namespace chromeos |
OLD | NEW |