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_descriptor_service_provider.h" | 5 #include "chromeos/dbus/bluetooth_gatt_descriptor_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/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 object_path_(object_path), | 43 object_path_(object_path), |
44 characteristic_path_(characteristic_path), | 44 characteristic_path_(characteristic_path), |
45 weak_ptr_factory_(this) { | 45 weak_ptr_factory_(this) { |
46 VLOG(1) << "Created Bluetooth GATT characteristic descriptor: " | 46 VLOG(1) << "Created Bluetooth GATT characteristic descriptor: " |
47 << object_path.value() << " UUID: " << uuid; | 47 << object_path.value() << " UUID: " << uuid; |
48 DCHECK(bus_); | 48 DCHECK(bus_); |
49 DCHECK(delegate_); | 49 DCHECK(delegate_); |
50 DCHECK(!uuid_.empty()); | 50 DCHECK(!uuid_.empty()); |
51 DCHECK(object_path_.IsValid()); | 51 DCHECK(object_path_.IsValid()); |
52 DCHECK(characteristic_path_.IsValid()); | 52 DCHECK(characteristic_path_.IsValid()); |
53 DCHECK(base::StartsWithASCII(object_path_.value(), | 53 DCHECK(base::StartsWith(object_path_.value(), |
54 characteristic_path_.value() + "/", true)); | 54 characteristic_path_.value() + "/", |
| 55 base::CompareCase::SENSITIVE)); |
55 | 56 |
56 exported_object_ = bus_->GetExportedObject(object_path_); | 57 exported_object_ = bus_->GetExportedObject(object_path_); |
57 | 58 |
58 exported_object_->ExportMethod( | 59 exported_object_->ExportMethod( |
59 dbus::kDBusPropertiesInterface, | 60 dbus::kDBusPropertiesInterface, |
60 dbus::kDBusPropertiesGet, | 61 dbus::kDBusPropertiesGet, |
61 base::Bind(&BluetoothGattDescriptorServiceProviderImpl::Get, | 62 base::Bind(&BluetoothGattDescriptorServiceProviderImpl::Get, |
62 weak_ptr_factory_.GetWeakPtr()), | 63 weak_ptr_factory_.GetWeakPtr()), |
63 base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnExported, | 64 base::Bind(&BluetoothGattDescriptorServiceProviderImpl::OnExported, |
64 weak_ptr_factory_.GetWeakPtr())); | 65 weak_ptr_factory_.GetWeakPtr())); |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 const dbus::ObjectPath& characteristic_path) { | 463 const dbus::ObjectPath& characteristic_path) { |
463 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { | 464 if (!DBusThreadManager::Get()->IsUsingStub(DBusClientBundle::BLUETOOTH)) { |
464 return new BluetoothGattDescriptorServiceProviderImpl( | 465 return new BluetoothGattDescriptorServiceProviderImpl( |
465 bus, object_path, delegate, uuid, permissions, characteristic_path); | 466 bus, object_path, delegate, uuid, permissions, characteristic_path); |
466 } | 467 } |
467 return new FakeBluetoothGattDescriptorServiceProvider( | 468 return new FakeBluetoothGattDescriptorServiceProvider( |
468 object_path, delegate, uuid, permissions, characteristic_path); | 469 object_path, delegate, uuid, permissions, characteristic_path); |
469 } | 470 } |
470 | 471 |
471 } // namespace chromeos | 472 } // namespace chromeos |
OLD | NEW |