Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chromeos/dbus/dbus_thread_manager.cc

Issue 10159004: Extends DBusThreadManager to connect ibus-bus. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Apply comments. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.h ('k') | chromeos/dbus/mock_dbus_thread_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/chromeos/chromeos_version.h" 7 #include "base/chromeos/chromeos_version.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
10 #include "chromeos/chromeos_switches.h" 10 #include "chromeos/chromeos_switches.h"
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 SpeechSynthesizerClient::Create(client_type, system_bus_.get())); 122 SpeechSynthesizerClient::Create(client_type, system_bus_.get()));
123 // Create the update engine client. 123 // Create the update engine client.
124 update_engine_client_.reset( 124 update_engine_client_.reset(
125 UpdateEngineClient::Create(client_type, system_bus_.get())); 125 UpdateEngineClient::Create(client_type, system_bus_.get()));
126 } 126 }
127 127
128 virtual ~DBusThreadManagerImpl() { 128 virtual ~DBusThreadManagerImpl() {
129 // Shut down the bus. During the browser shutdown, it's ok to shut down 129 // Shut down the bus. During the browser shutdown, it's ok to shut down
130 // the bus synchronously. 130 // the bus synchronously.
131 system_bus_->ShutdownOnDBusThreadAndBlock(); 131 system_bus_->ShutdownOnDBusThreadAndBlock();
132 if (ibus_bus_.get())
133 ibus_bus_->ShutdownOnDBusThreadAndBlock();
132 134
133 // Stop the D-Bus thread. 135 // Stop the D-Bus thread.
134 dbus_thread_->Stop(); 136 dbus_thread_->Stop();
135 } 137 }
136 138
137 // DBusThreadManager override. 139 // DBusThreadManager override.
140 virtual void InitIBusBus(const std::string &ibus_address) OVERRIDE {
141 DCHECK(!ibus_bus_);
142 dbus::Bus::Options ibus_bus_options;
143 ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS;
144 ibus_bus_options.address = ibus_address;
145 ibus_bus_options.connection_type = dbus::Bus::PRIVATE;
146 ibus_bus_options.dbus_thread_message_loop_proxy =
147 dbus_thread_->message_loop_proxy();
148 ibus_bus_ = new dbus::Bus(ibus_bus_options);
149 ibus_address_ = ibus_address;
150 VLOG(1) << "Connected to ibus-daemon:" << ibus_address;
satorux1 2012/05/18 01:05:37 "Connected to ibus-daemon: "
Seigo Nonaka 2012/05/18 01:09:10 Done.
151 }
152
153 // DBusThreadManager override.
138 virtual dbus::Bus* GetSystemBus() OVERRIDE { 154 virtual dbus::Bus* GetSystemBus() OVERRIDE {
139 return system_bus_.get(); 155 return system_bus_.get();
140 } 156 }
141 157
142 // DBusThreadManager override. 158 // DBusThreadManager override.
159 virtual dbus::Bus* GetIBusBus() OVERRIDE {
160 return ibus_bus_.get();
161 }
162
163 // DBusThreadManager override.
143 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { 164 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE {
144 return bluetooth_adapter_client_.get(); 165 return bluetooth_adapter_client_.get();
145 } 166 }
146 167
147 // DBusThreadManager override. 168 // DBusThreadManager override.
148 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { 169 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE {
149 return bluetooth_device_client_.get(); 170 return bluetooth_device_client_.get();
150 } 171 }
151 172
152 // DBusThreadManager override. 173 // DBusThreadManager override.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 return speech_synthesizer_client_.get(); 265 return speech_synthesizer_client_.get();
245 } 266 }
246 267
247 // DBusThreadManager override. 268 // DBusThreadManager override.
248 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE { 269 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE {
249 return update_engine_client_.get(); 270 return update_engine_client_.get();
250 } 271 }
251 272
252 scoped_ptr<base::Thread> dbus_thread_; 273 scoped_ptr<base::Thread> dbus_thread_;
253 scoped_refptr<dbus::Bus> system_bus_; 274 scoped_refptr<dbus::Bus> system_bus_;
275 scoped_refptr<dbus::Bus> ibus_bus_;
254 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; 276 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
255 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; 277 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
256 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; 278 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
257 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_; 279 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
258 scoped_ptr<BluetoothNodeClient> bluetooth_node_client_; 280 scoped_ptr<BluetoothNodeClient> bluetooth_node_client_;
259 scoped_ptr<CashewClient> cashew_client_; 281 scoped_ptr<CashewClient> cashew_client_;
260 scoped_ptr<CrosDisksClient> cros_disks_client_; 282 scoped_ptr<CrosDisksClient> cros_disks_client_;
261 scoped_ptr<CryptohomeClient> cryptohome_client_; 283 scoped_ptr<CryptohomeClient> cryptohome_client_;
262 scoped_ptr<DebugDaemonClient> debugdaemon_client_; 284 scoped_ptr<DebugDaemonClient> debugdaemon_client_;
263 scoped_ptr<FlimflamDeviceClient> flimflam_device_client_; 285 scoped_ptr<FlimflamDeviceClient> flimflam_device_client_;
264 scoped_ptr<FlimflamIPConfigClient> flimflam_ipconfig_client_; 286 scoped_ptr<FlimflamIPConfigClient> flimflam_ipconfig_client_;
265 scoped_ptr<FlimflamManagerClient> flimflam_manager_client_; 287 scoped_ptr<FlimflamManagerClient> flimflam_manager_client_;
266 scoped_ptr<FlimflamNetworkClient> flimflam_network_client_; 288 scoped_ptr<FlimflamNetworkClient> flimflam_network_client_;
267 scoped_ptr<FlimflamProfileClient> flimflam_profile_client_; 289 scoped_ptr<FlimflamProfileClient> flimflam_profile_client_;
268 scoped_ptr<FlimflamServiceClient> flimflam_service_client_; 290 scoped_ptr<FlimflamServiceClient> flimflam_service_client_;
269 scoped_ptr<GsmSMSClient> gsm_sms_client_; 291 scoped_ptr<GsmSMSClient> gsm_sms_client_;
270 scoped_ptr<ImageBurnerClient> image_burner_client_; 292 scoped_ptr<ImageBurnerClient> image_burner_client_;
271 scoped_ptr<IntrospectableClient> introspectable_client_; 293 scoped_ptr<IntrospectableClient> introspectable_client_;
272 scoped_ptr<PowerManagerClient> power_manager_client_; 294 scoped_ptr<PowerManagerClient> power_manager_client_;
273 scoped_ptr<SessionManagerClient> session_manager_client_; 295 scoped_ptr<SessionManagerClient> session_manager_client_;
274 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_; 296 scoped_ptr<SpeechSynthesizerClient> speech_synthesizer_client_;
275 scoped_ptr<UpdateEngineClient> update_engine_client_; 297 scoped_ptr<UpdateEngineClient> update_engine_client_;
298
299 std::string ibus_address_;
276 }; 300 };
277 301
278 // static 302 // static
279 void DBusThreadManager::Initialize() { 303 void DBusThreadManager::Initialize() {
280 if (g_dbus_thread_manager) { 304 if (g_dbus_thread_manager) {
281 LOG(WARNING) << "DBusThreadManager was already initialized"; 305 LOG(WARNING) << "DBusThreadManager was already initialized";
282 return; 306 return;
283 } 307 }
284 // Determine whether we use stub or real client implementations. 308 // Determine whether we use stub or real client implementations.
285 if (base::chromeos::IsRunningOnChromeOS()) { 309 if (base::chromeos::IsRunningOnChromeOS()) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } 355 }
332 356
333 // static 357 // static
334 DBusThreadManager* DBusThreadManager::Get() { 358 DBusThreadManager* DBusThreadManager::Get() {
335 CHECK(g_dbus_thread_manager) 359 CHECK(g_dbus_thread_manager)
336 << "DBusThreadManager::Get() called before Initialize()"; 360 << "DBusThreadManager::Get() called before Initialize()";
337 return g_dbus_thread_manager; 361 return g_dbus_thread_manager;
338 } 362 }
339 363
340 } // namespace chromeos 364 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/dbus_thread_manager.h ('k') | chromeos/dbus/mock_dbus_thread_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698