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

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: Rebase on http://codereview.chromium.org/10195001/ and separate initialization. Created 8 years, 8 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
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/environment.h"
8 #include "base/threading/thread.h" 9 #include "base/threading/thread.h"
9 #include "chromeos/dbus/bluetooth_adapter_client.h" 10 #include "chromeos/dbus/bluetooth_adapter_client.h"
10 #include "chromeos/dbus/bluetooth_device_client.h" 11 #include "chromeos/dbus/bluetooth_device_client.h"
11 #include "chromeos/dbus/bluetooth_input_client.h" 12 #include "chromeos/dbus/bluetooth_input_client.h"
12 #include "chromeos/dbus/bluetooth_manager_client.h" 13 #include "chromeos/dbus/bluetooth_manager_client.h"
13 #include "chromeos/dbus/bluetooth_node_client.h" 14 #include "chromeos/dbus/bluetooth_node_client.h"
14 #include "chromeos/dbus/cashew_client.h" 15 #include "chromeos/dbus/cashew_client.h"
15 #include "chromeos/dbus/cros_disks_client.h" 16 #include "chromeos/dbus/cros_disks_client.h"
16 #include "chromeos/dbus/cryptohome_client.h" 17 #include "chromeos/dbus/cryptohome_client.h"
17 #include "chromeos/dbus/dbus_client_implementation_type.h" 18 #include "chromeos/dbus/dbus_client_implementation_type.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 virtual ~DBusThreadManagerImpl() { 125 virtual ~DBusThreadManagerImpl() {
125 // Shut down the bus. During the browser shutdown, it's ok to shut down 126 // Shut down the bus. During the browser shutdown, it's ok to shut down
126 // the bus synchronously. 127 // the bus synchronously.
127 system_bus_->ShutdownOnDBusThreadAndBlock(); 128 system_bus_->ShutdownOnDBusThreadAndBlock();
128 129
129 // Stop the D-Bus thread. 130 // Stop the D-Bus thread.
130 dbus_thread_->Stop(); 131 dbus_thread_->Stop();
131 } 132 }
132 133
133 // DBusThreadManager override. 134 // DBusThreadManager override.
135 virtual void InitializeIBusBus(const std::string &ibus_address) OVERRIDE {
136 if (ibus_bus_) {
137 LOG(WARNING) << "The IBusBus was already initialized.";
138 return;
139 }
140 dbus::Bus::Options ibus_bus_options;
141 ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS;
142 ibus_bus_options.address = ibus_address;
143 ibus_bus_options.connection_type = dbus::Bus::PRIVATE;
144 ibus_bus_options.dbus_thread_message_loop_proxy =
145 dbus_thread_->message_loop_proxy();
146 ibus_bus_ = new dbus::Bus(ibus_bus_options);
Yusuke Sato 2012/04/24 04:58:37 This line could be executed before ibus-daemon act
Seigo Nonaka 2012/04/26 00:14:32 Thank you for your kindly notification. I introdu
147 VLOG(1) << "Connected to ibus-daemon.(address:" << ibus_address << ")";
148 }
149
150 // DBusThreadManager override.
134 virtual dbus::Bus* GetSystemBus() OVERRIDE { 151 virtual dbus::Bus* GetSystemBus() OVERRIDE {
135 return system_bus_.get(); 152 return system_bus_.get();
136 } 153 }
137 154
138 // DBusThreadManager override. 155 // DBusThreadManager override.
156 virtual dbus::Bus* GetIBusBus() OVERRIDE {
157 return ibus_bus_.get();
158 }
159
160 // DBusThreadManager override.
139 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE { 161 virtual BluetoothAdapterClient* GetBluetoothAdapterClient() OVERRIDE {
140 return bluetooth_adapter_client_.get(); 162 return bluetooth_adapter_client_.get();
141 } 163 }
142 164
143 // DBusThreadManager override. 165 // DBusThreadManager override.
144 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE { 166 virtual BluetoothDeviceClient* GetBluetoothDeviceClient() OVERRIDE {
145 return bluetooth_device_client_.get(); 167 return bluetooth_device_client_.get();
146 } 168 }
147 169
148 // DBusThreadManager override. 170 // DBusThreadManager override.
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 return speech_synthesizer_client_.get(); 262 return speech_synthesizer_client_.get();
241 } 263 }
242 264
243 // DBusThreadManager override. 265 // DBusThreadManager override.
244 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE { 266 virtual UpdateEngineClient* GetUpdateEngineClient() OVERRIDE {
245 return update_engine_client_.get(); 267 return update_engine_client_.get();
246 } 268 }
247 269
248 scoped_ptr<base::Thread> dbus_thread_; 270 scoped_ptr<base::Thread> dbus_thread_;
249 scoped_refptr<dbus::Bus> system_bus_; 271 scoped_refptr<dbus::Bus> system_bus_;
272 scoped_refptr<dbus::Bus> ibus_bus_;
250 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_; 273 scoped_ptr<BluetoothAdapterClient> bluetooth_adapter_client_;
251 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_; 274 scoped_ptr<BluetoothDeviceClient> bluetooth_device_client_;
252 scoped_ptr<BluetoothInputClient> bluetooth_input_client_; 275 scoped_ptr<BluetoothInputClient> bluetooth_input_client_;
253 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_; 276 scoped_ptr<BluetoothManagerClient> bluetooth_manager_client_;
254 scoped_ptr<BluetoothNodeClient> bluetooth_node_client_; 277 scoped_ptr<BluetoothNodeClient> bluetooth_node_client_;
255 scoped_ptr<CashewClient> cashew_client_; 278 scoped_ptr<CashewClient> cashew_client_;
256 scoped_ptr<CrosDisksClient> cros_disks_client_; 279 scoped_ptr<CrosDisksClient> cros_disks_client_;
257 scoped_ptr<CryptohomeClient> cryptohome_client_; 280 scoped_ptr<CryptohomeClient> cryptohome_client_;
258 scoped_ptr<DebugDaemonClient> debugdaemon_client_; 281 scoped_ptr<DebugDaemonClient> debugdaemon_client_;
259 scoped_ptr<FlimflamDeviceClient> flimflam_device_client_; 282 scoped_ptr<FlimflamDeviceClient> flimflam_device_client_;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 334 }
312 335
313 // static 336 // static
314 DBusThreadManager* DBusThreadManager::Get() { 337 DBusThreadManager* DBusThreadManager::Get() {
315 CHECK(g_dbus_thread_manager) 338 CHECK(g_dbus_thread_manager)
316 << "DBusThreadManager::Get() called before Initialize()"; 339 << "DBusThreadManager::Get() called before Initialize()";
317 return g_dbus_thread_manager; 340 return g_dbus_thread_manager;
318 } 341 }
319 342
320 } // namespace chromeos 343 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698