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

Side by Side Diff: device/bluetooth/dbus/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 "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.h" 5 #include "device/bluetooth/dbus/bluetooth_le_advertising_manager_client.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/macros.h" 9 #include "base/macros.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 dbus::ObjectProxy* object_proxy = 126 dbus::ObjectProxy* object_proxy =
127 object_manager_->GetObjectProxy(manager_object_path); 127 object_manager_->GetObjectProxy(manager_object_path);
128 object_proxy->CallMethodWithErrorCallback( 128 object_proxy->CallMethodWithErrorCallback(
129 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 129 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
130 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnSuccess, 130 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnSuccess,
131 weak_ptr_factory_.GetWeakPtr(), callback), 131 weak_ptr_factory_.GetWeakPtr(), callback),
132 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError, 132 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError,
133 weak_ptr_factory_.GetWeakPtr(), error_callback)); 133 weak_ptr_factory_.GetWeakPtr(), error_callback));
134 } 134 }
135 135
136 void ResetAdvertising(const dbus::ObjectPath& manager_object_path,
137 const base::Closure& callback,
138 const ErrorCallback& error_callback) override {
139 dbus::MethodCall method_call(
140 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface,
141 bluetooth_advertising_manager::kResetAdvertising);
142
143 DCHECK(object_manager_);
144 dbus::ObjectProxy* object_proxy =
145 object_manager_->GetObjectProxy(manager_object_path);
146 object_proxy->CallMethodWithErrorCallback(
147 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
148 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnSuccess,
149 weak_ptr_factory_.GetWeakPtr(), callback),
150 base::Bind(&BluetoothAdvertisementManagerClientImpl::OnError,
151 weak_ptr_factory_.GetWeakPtr(), error_callback));
152 }
153
136 protected: 154 protected:
137 void Init(dbus::Bus* bus) override { 155 void Init(dbus::Bus* bus) override {
138 DCHECK(bus); 156 DCHECK(bus);
139 object_manager_ = bus->GetObjectManager( 157 object_manager_ = bus->GetObjectManager(
140 bluetooth_object_manager::kBluetoothObjectManagerServiceName, 158 bluetooth_object_manager::kBluetoothObjectManagerServiceName,
141 dbus::ObjectPath( 159 dbus::ObjectPath(
142 bluetooth_object_manager::kBluetoothObjectManagerServicePath)); 160 bluetooth_object_manager::kBluetoothObjectManagerServicePath));
143 object_manager_->RegisterInterface( 161 object_manager_->RegisterInterface(
144 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface, 162 bluetooth_advertising_manager::kBluetoothAdvertisingManagerInterface,
145 this); 163 this);
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {} 221 BluetoothLEAdvertisingManagerClient::BluetoothLEAdvertisingManagerClient() {}
204 222
205 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {} 223 BluetoothLEAdvertisingManagerClient::~BluetoothLEAdvertisingManagerClient() {}
206 224
207 BluetoothLEAdvertisingManagerClient* 225 BluetoothLEAdvertisingManagerClient*
208 BluetoothLEAdvertisingManagerClient::Create() { 226 BluetoothLEAdvertisingManagerClient::Create() {
209 return new BluetoothAdvertisementManagerClientImpl(); 227 return new BluetoothAdvertisementManagerClientImpl();
210 } 228 }
211 229
212 } // namespace bluez 230 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698