OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bluetooth_gatt_service_service_provider.h" | 5 #include "chromeos/dbus/bluetooth_gatt_service_service_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/sys_info.h" | |
12 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
| 12 #include "chromeos/dbus/dbus_thread_manager.h" |
13 #include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h" | 13 #include "chromeos/dbus/fake_bluetooth_gatt_service_service_provider.h" |
14 #include "dbus/exported_object.h" | 14 #include "dbus/exported_object.h" |
15 #include "dbus/message.h" | 15 #include "dbus/message.h" |
16 #include "third_party/cros_system_api/dbus/service_constants.h" | 16 #include "third_party/cros_system_api/dbus/service_constants.h" |
17 | 17 |
18 namespace chromeos { | 18 namespace chromeos { |
19 namespace { | 19 namespace { |
20 const char kErrorInvalidArgs[] = | 20 const char kErrorInvalidArgs[] = |
21 "org.freedesktop.DBus.Error.InvalidArgs"; | 21 "org.freedesktop.DBus.Error.InvalidArgs"; |
22 const char kErrorPropertyReadOnly[] = | 22 const char kErrorPropertyReadOnly[] = |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() { | 262 BluetoothGattServiceServiceProvider::~BluetoothGattServiceServiceProvider() { |
263 } | 263 } |
264 | 264 |
265 // static | 265 // static |
266 BluetoothGattServiceServiceProvider* | 266 BluetoothGattServiceServiceProvider* |
267 BluetoothGattServiceServiceProvider::Create( | 267 BluetoothGattServiceServiceProvider::Create( |
268 dbus::Bus* bus, | 268 dbus::Bus* bus, |
269 const dbus::ObjectPath& object_path, | 269 const dbus::ObjectPath& object_path, |
270 const std::string& uuid, | 270 const std::string& uuid, |
271 const std::vector<dbus::ObjectPath>& includes) { | 271 const std::vector<dbus::ObjectPath>& includes) { |
272 if (base::SysInfo::IsRunningOnChromeOS()) { | 272 if (!DBusThreadManager::IsUsingStub(DBusClientBundle::BLUETOOTH)) { |
273 return new BluetoothGattServiceServiceProviderImpl( | 273 return new BluetoothGattServiceServiceProviderImpl( |
274 bus, object_path, uuid, includes); | 274 bus, object_path, uuid, includes); |
275 } | 275 } |
276 return new FakeBluetoothGattServiceServiceProvider( | 276 return new FakeBluetoothGattServiceServiceProvider( |
277 object_path, uuid, includes); | 277 object_path, uuid, includes); |
278 } | 278 } |
279 | 279 |
280 } // namespace chromeos | 280 } // namespace chromeos |
OLD | NEW |