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

Side by Side Diff: device/bluetooth/dbus/fake_bluetooth_le_advertising_manager_client.cc

Issue 2861533004: Implement chrome.bluetoothLowEnergy.resetAdvertising(). (Closed)
Patch Set: Implement chrome.bluetoothLowEnergy.resetAllAdvertisements(). Created 3 years, 5 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 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/threading/thread_task_runner_handle.h" 8 #include "base/threading/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"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 const ErrorCallback& error_callback) { 101 const ErrorCallback& error_callback) {
102 if (min_interval_ms < kMinIntervalMs || max_interval_ms > kMaxIntervalMs || 102 if (min_interval_ms < kMinIntervalMs || max_interval_ms > kMaxIntervalMs ||
103 min_interval_ms > max_interval_ms) { 103 min_interval_ms > max_interval_ms) {
104 error_callback.Run(bluetooth_advertising_manager::kErrorInvalidArguments, 104 error_callback.Run(bluetooth_advertising_manager::kErrorInvalidArguments,
105 "Invalid interval."); 105 "Invalid interval.");
106 return; 106 return;
107 } 107 }
108 callback.Run(); 108 callback.Run();
109 } 109 }
110 110
111 void FakeBluetoothLEAdvertisingManagerClient::ResetAdvertising(
112 const dbus::ObjectPath& object_path,
113 const base::Closure& callback,
114 const ErrorCallback& error_callback) {
115 currently_registered_.clear();
116 service_provider_map_.clear();
117 callback.Run();
118 }
119
111 void FakeBluetoothLEAdvertisingManagerClient:: 120 void FakeBluetoothLEAdvertisingManagerClient::
112 RegisterAdvertisementServiceProvider( 121 RegisterAdvertisementServiceProvider(
113 FakeBluetoothLEAdvertisementServiceProvider* service_provider) { 122 FakeBluetoothLEAdvertisementServiceProvider* service_provider) {
114 service_provider_map_[service_provider->object_path_] = service_provider; 123 service_provider_map_[service_provider->object_path_] = service_provider;
115 } 124 }
116 125
117 void FakeBluetoothLEAdvertisingManagerClient:: 126 void FakeBluetoothLEAdvertisingManagerClient::
118 UnregisterAdvertisementServiceProvider( 127 UnregisterAdvertisementServiceProvider(
119 FakeBluetoothLEAdvertisementServiceProvider* service_provider) { 128 FakeBluetoothLEAdvertisementServiceProvider* service_provider) {
120 ServiceProviderMap::iterator iter = 129 ServiceProviderMap::iterator iter =
121 service_provider_map_.find(service_provider->object_path_); 130 service_provider_map_.find(service_provider->object_path_);
122 if (iter != service_provider_map_.end() && iter->second == service_provider) 131 if (iter != service_provider_map_.end() && iter->second == service_provider)
123 service_provider_map_.erase(iter); 132 service_provider_map_.erase(iter);
124 } 133 }
125 134
126 } // namespace bluez 135 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698