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/cros_disks_client.h" |
12 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 13 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
13 #include "chrome/browser/chromeos/dbus/sensors_client.h" | 14 #include "chrome/browser/chromeos/dbus/sensors_client.h" |
14 #include "chrome/browser/chromeos/dbus/session_manager_client.h" | 15 #include "chrome/browser/chromeos/dbus/session_manager_client.h" |
15 #include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h" | 16 #include "chrome/browser/chromeos/dbus/speech_synthesizer_client.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "dbus/bus.h" | 18 #include "dbus/bus.h" |
18 | 19 |
19 namespace chromeos { | 20 namespace chromeos { |
20 | 21 |
21 static DBusThreadManager* g_dbus_thread_manager = NULL; | 22 static DBusThreadManager* g_dbus_thread_manager = NULL; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 57 } |
57 | 58 |
58 // Create the power manager client. | 59 // Create the power manager client. |
59 power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get())); | 60 power_manager_client_.reset(PowerManagerClient::Create(system_bus_.get())); |
60 // Create the session manager client. | 61 // Create the session manager client. |
61 session_manager_client_.reset( | 62 session_manager_client_.reset( |
62 SessionManagerClient::Create(system_bus_.get())); | 63 SessionManagerClient::Create(system_bus_.get())); |
63 // Create the speech synthesizer client. | 64 // Create the speech synthesizer client. |
64 speech_synthesizer_client_.reset( | 65 speech_synthesizer_client_.reset( |
65 SpeechSynthesizerClient::Create(system_bus_.get())); | 66 SpeechSynthesizerClient::Create(system_bus_.get())); |
| 67 // Create the cros-disks client. |
| 68 cros_disks_client_.reset( |
| 69 CrosDisksClient::Create(system_bus_.get())); |
66 } | 70 } |
67 | 71 |
68 virtual ~DBusThreadManagerImpl() { | 72 virtual ~DBusThreadManagerImpl() { |
69 // Shut down the bus. During the browser shutdown, it's ok to shut down | 73 // Shut down the bus. During the browser shutdown, it's ok to shut down |
70 // the bus synchronously. | 74 // the bus synchronously. |
71 system_bus_->ShutdownOnDBusThreadAndBlock(); | 75 system_bus_->ShutdownOnDBusThreadAndBlock(); |
72 | 76 |
73 // Stop the D-Bus thread. | 77 // Stop the D-Bus thread. |
74 dbus_thread_->Stop(); | 78 dbus_thread_->Stop(); |
75 } | 79 } |
(...skipping 21 matching lines...) Expand all Loading... |
97 // DBusThreadManager override. | 101 // DBusThreadManager override. |
98 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { | 102 virtual SessionManagerClient* GetSessionManagerClient() OVERRIDE { |
99 return session_manager_client_.get(); | 103 return session_manager_client_.get(); |
100 } | 104 } |
101 | 105 |
102 // DBusThreadManager override. | 106 // DBusThreadManager override. |
103 virtual SpeechSynthesizerClient* GetSpeechSynthesizerClient() OVERRIDE { | 107 virtual SpeechSynthesizerClient* GetSpeechSynthesizerClient() OVERRIDE { |
104 return speech_synthesizer_client_.get(); | 108 return speech_synthesizer_client_.get(); |
105 } | 109 } |
106 | 110 |
| 111 // DBusThreadManager override. |
| 112 virtual CrosDisksClient* GetCrosDisksClient() { |
| 113 return cros_disks_client_.get(); |
| 114 } |
| 115 |
107 scoped_ptr<base::Thread> dbus_thread_; | 116 scoped_ptr<base::Thread> dbus_thread_; |
108 scoped_refptr<dbus::Bus> system_bus_; | 117 scoped_refptr<dbus::Bus> system_bus_; |
109 scoped_ptr<CrosDBusService> cros_dbus_service_; | 118 scoped_ptr<CrosDBusService> cros_dbus_service_; |
110 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; | 119 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; |
111 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_; | 120 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_; |
112 scoped_ptr<PowerManagerClient> power_manager_client_; | 121 scoped_ptr<PowerManagerClient> power_manager_client_; |
113 scoped_ptr<SensorsClient> sensors_client_; | 122 scoped_ptr<SensorsClient> sensors_client_; |
114 scoped_ptr<SessionManagerClient> session_manager_client_; | 123 scoped_ptr<SessionManagerClient> session_manager_client_; |
115 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; | 124 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; |
| 125 scoped_ptr<CrosDisksClient> cros_disks_client_; |
116 }; | 126 }; |
117 | 127 |
118 // static | 128 // static |
119 void DBusThreadManager::Initialize() { | 129 void DBusThreadManager::Initialize() { |
120 if (g_dbus_thread_manager) { | 130 if (g_dbus_thread_manager) { |
121 LOG(WARNING) << "DBusThreadManager was already initialized"; | 131 LOG(WARNING) << "DBusThreadManager was already initialized"; |
122 return; | 132 return; |
123 } | 133 } |
124 g_dbus_thread_manager = new DBusThreadManagerImpl; | 134 g_dbus_thread_manager = new DBusThreadManagerImpl; |
125 VLOG(1) << "DBusThreadManager initialized"; | 135 VLOG(1) << "DBusThreadManager initialized"; |
(...skipping 29 matching lines...) Expand all Loading... |
155 } | 165 } |
156 | 166 |
157 // static | 167 // static |
158 DBusThreadManager* DBusThreadManager::Get() { | 168 DBusThreadManager* DBusThreadManager::Get() { |
159 CHECK(g_dbus_thread_manager) | 169 CHECK(g_dbus_thread_manager) |
160 << "DBusThreadManager::Get() called before Initialize()"; | 170 << "DBusThreadManager::Get() called before Initialize()"; |
161 return g_dbus_thread_manager; | 171 return g_dbus_thread_manager; |
162 } | 172 } |
163 | 173 |
164 } // namespace chromeos | 174 } // namespace chromeos |
OLD | NEW |