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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // Create the D-Bus thread. | 65 // Create the D-Bus thread. |
66 base::Thread::Options thread_options; | 66 base::Thread::Options thread_options; |
67 thread_options.message_loop_type = MessageLoop::TYPE_IO; | 67 thread_options.message_loop_type = MessageLoop::TYPE_IO; |
68 dbus_thread_.reset(new base::Thread("D-Bus thread")); | 68 dbus_thread_.reset(new base::Thread("D-Bus thread")); |
69 dbus_thread_->StartWithOptions(thread_options); | 69 dbus_thread_->StartWithOptions(thread_options); |
70 | 70 |
71 // Create the connection to the system bus. | 71 // Create the connection to the system bus. |
72 dbus::Bus::Options system_bus_options; | 72 dbus::Bus::Options system_bus_options; |
73 system_bus_options.bus_type = dbus::Bus::SYSTEM; | 73 system_bus_options.bus_type = dbus::Bus::SYSTEM; |
74 system_bus_options.connection_type = dbus::Bus::PRIVATE; | 74 system_bus_options.connection_type = dbus::Bus::PRIVATE; |
75 system_bus_options.dbus_thread_message_loop_proxy = | 75 system_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
76 dbus_thread_->message_loop_proxy(); | |
77 system_bus_ = new dbus::Bus(system_bus_options); | 76 system_bus_ = new dbus::Bus(system_bus_options); |
78 | 77 |
79 bluetooth_manager_client_.reset(BluetoothManagerClient::Create( | 78 bluetooth_manager_client_.reset(BluetoothManagerClient::Create( |
80 client_type, system_bus_.get())); | 79 client_type, system_bus_.get())); |
81 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create( | 80 bluetooth_adapter_client_.reset(BluetoothAdapterClient::Create( |
82 client_type, system_bus_.get(), bluetooth_manager_client_.get())); | 81 client_type, system_bus_.get(), bluetooth_manager_client_.get())); |
83 bluetooth_device_client_.reset(BluetoothDeviceClient::Create( | 82 bluetooth_device_client_.reset(BluetoothDeviceClient::Create( |
84 client_type, system_bus_.get(), bluetooth_adapter_client_.get())); | 83 client_type, system_bus_.get(), bluetooth_adapter_client_.get())); |
85 bluetooth_input_client_.reset(BluetoothInputClient::Create( | 84 bluetooth_input_client_.reset(BluetoothInputClient::Create( |
86 client_type, system_bus_.get(), bluetooth_adapter_client_.get())); | 85 client_type, system_bus_.get(), bluetooth_adapter_client_.get())); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 observers_.RemoveObserver(observer); | 161 observers_.RemoveObserver(observer); |
163 } | 162 } |
164 | 163 |
165 // DBusThreadManager override. | 164 // DBusThreadManager override. |
166 virtual void InitIBusBus(const std::string &ibus_address) OVERRIDE { | 165 virtual void InitIBusBus(const std::string &ibus_address) OVERRIDE { |
167 DCHECK(!ibus_bus_); | 166 DCHECK(!ibus_bus_); |
168 dbus::Bus::Options ibus_bus_options; | 167 dbus::Bus::Options ibus_bus_options; |
169 ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS; | 168 ibus_bus_options.bus_type = dbus::Bus::CUSTOM_ADDRESS; |
170 ibus_bus_options.address = ibus_address; | 169 ibus_bus_options.address = ibus_address; |
171 ibus_bus_options.connection_type = dbus::Bus::PRIVATE; | 170 ibus_bus_options.connection_type = dbus::Bus::PRIVATE; |
172 ibus_bus_options.dbus_thread_message_loop_proxy = | 171 ibus_bus_options.dbus_task_runner = dbus_thread_->message_loop_proxy(); |
173 dbus_thread_->message_loop_proxy(); | |
174 ibus_bus_ = new dbus::Bus(ibus_bus_options); | 172 ibus_bus_ = new dbus::Bus(ibus_bus_options); |
175 ibus_address_ = ibus_address; | 173 ibus_address_ = ibus_address; |
176 VLOG(1) << "Connected to ibus-daemon: " << ibus_address; | 174 VLOG(1) << "Connected to ibus-daemon: " << ibus_address; |
177 | 175 |
178 DBusClientImplementationType client_type = | 176 DBusClientImplementationType client_type = |
179 base::chromeos::IsRunningOnChromeOS() ? REAL_DBUS_CLIENT_IMPLEMENTATION | 177 base::chromeos::IsRunningOnChromeOS() ? REAL_DBUS_CLIENT_IMPLEMENTATION |
180 : STUB_DBUS_CLIENT_IMPLEMENTATION; | 178 : STUB_DBUS_CLIENT_IMPLEMENTATION; |
181 | 179 |
182 ibus_client_.reset( | 180 ibus_client_.reset( |
183 IBusClient::Create(client_type, ibus_bus_.get())); | 181 IBusClient::Create(client_type, ibus_bus_.get())); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 } | 450 } |
453 | 451 |
454 // static | 452 // static |
455 DBusThreadManager* DBusThreadManager::Get() { | 453 DBusThreadManager* DBusThreadManager::Get() { |
456 CHECK(g_dbus_thread_manager) | 454 CHECK(g_dbus_thread_manager) |
457 << "DBusThreadManager::Get() called before Initialize()"; | 455 << "DBusThreadManager::Get() called before Initialize()"; |
458 return g_dbus_thread_manager; | 456 return g_dbus_thread_manager; |
459 } | 457 } |
460 | 458 |
461 } // namespace chromeos | 459 } // namespace chromeos |
OLD | NEW |