| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/location.h" | 5 #include "base/location.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/single_thread_task_runner.h" | 7 #include "base/single_thread_task_runner.h" |
| 8 #include "base/thread_task_runner_handle.h" | 8 #include "base/thread_task_runner_handle.h" |
| 9 #include "dbus/bus.h" | 9 #include "dbus/bus.h" |
| 10 #include "dbus/message.h" | 10 #include "dbus/message.h" |
| 11 #include "dbus/object_proxy.h" | 11 #include "dbus/object_proxy.h" |
| 12 #include "fake_bluetooth_le_advertisement_service_provider.h" | 12 #include "fake_bluetooth_le_advertisement_service_provider.h" |
| 13 #include "fake_bluetooth_le_advertising_manager_client.h" | 13 #include "fake_bluetooth_le_advertising_manager_client.h" |
| 14 #include "third_party/cros_system_api/dbus/service_constants.h" | 14 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 15 | 15 |
| 16 namespace chromeos { | 16 namespace bluez { |
| 17 | 17 |
| 18 const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] = | 18 const char FakeBluetoothLEAdvertisingManagerClient::kAdvertisingManagerPath[] = |
| 19 "/fake/hci0"; | 19 "/fake/hci0"; |
| 20 | 20 |
| 21 FakeBluetoothLEAdvertisingManagerClient:: | 21 FakeBluetoothLEAdvertisingManagerClient:: |
| 22 FakeBluetoothLEAdvertisingManagerClient() { | 22 FakeBluetoothLEAdvertisingManagerClient() {} |
| 23 } | |
| 24 | 23 |
| 25 FakeBluetoothLEAdvertisingManagerClient:: | 24 FakeBluetoothLEAdvertisingManagerClient:: |
| 26 ~FakeBluetoothLEAdvertisingManagerClient() { | 25 ~FakeBluetoothLEAdvertisingManagerClient() {} |
| 27 } | |
| 28 | 26 |
| 29 void FakeBluetoothLEAdvertisingManagerClient::Init(dbus::Bus* bus) { | 27 void FakeBluetoothLEAdvertisingManagerClient::Init(dbus::Bus* bus) {} |
| 30 } | |
| 31 | 28 |
| 32 void FakeBluetoothLEAdvertisingManagerClient::AddObserver(Observer* observer) { | 29 void FakeBluetoothLEAdvertisingManagerClient::AddObserver(Observer* observer) {} |
| 33 } | |
| 34 | 30 |
| 35 void FakeBluetoothLEAdvertisingManagerClient::RemoveObserver( | 31 void FakeBluetoothLEAdvertisingManagerClient::RemoveObserver( |
| 36 Observer* observer) { | 32 Observer* observer) {} |
| 37 } | |
| 38 | 33 |
| 39 void FakeBluetoothLEAdvertisingManagerClient::RegisterAdvertisement( | 34 void FakeBluetoothLEAdvertisingManagerClient::RegisterAdvertisement( |
| 40 const dbus::ObjectPath& manager_object_path, | 35 const dbus::ObjectPath& manager_object_path, |
| 41 const dbus::ObjectPath& advertisement_object_path, | 36 const dbus::ObjectPath& advertisement_object_path, |
| 42 const base::Closure& callback, | 37 const base::Closure& callback, |
| 43 const ErrorCallback& error_callback) { | 38 const ErrorCallback& error_callback) { |
| 44 VLOG(1) << "RegisterAdvertisment: " << advertisement_object_path.value(); | 39 VLOG(1) << "RegisterAdvertisment: " << advertisement_object_path.value(); |
| 45 | 40 |
| 46 if (manager_object_path != dbus::ObjectPath(kAdvertisingManagerPath)) { | 41 if (manager_object_path != dbus::ObjectPath(kAdvertisingManagerPath)) { |
| 47 error_callback.Run(kNoResponseError, "Invalid Advertising Manager path."); | 42 error_callback.Run(kNoResponseError, "Invalid Advertising Manager path."); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 91 |
| 97 void FakeBluetoothLEAdvertisingManagerClient:: | 92 void FakeBluetoothLEAdvertisingManagerClient:: |
| 98 UnregisterAdvertisementServiceProvider( | 93 UnregisterAdvertisementServiceProvider( |
| 99 FakeBluetoothLEAdvertisementServiceProvider* service_provider) { | 94 FakeBluetoothLEAdvertisementServiceProvider* service_provider) { |
| 100 ServiceProviderMap::iterator iter = | 95 ServiceProviderMap::iterator iter = |
| 101 service_provider_map_.find(service_provider->object_path_); | 96 service_provider_map_.find(service_provider->object_path_); |
| 102 if (iter != service_provider_map_.end() && iter->second == service_provider) | 97 if (iter != service_provider_map_.end() && iter->second == service_provider) |
| 103 service_provider_map_.erase(iter); | 98 service_provider_map_.erase(iter); |
| 104 } | 99 } |
| 105 | 100 |
| 106 } // namespace chromeos | 101 } // namespace bluez |
| OLD | NEW |