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

Side by Side Diff: device/bluetooth/bluetooth_device.h

Issue 180163009: chrome.bluetooth API improvements. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review feedback. Created 6 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/strings/string16.h" 13 #include "base/strings/string16.h"
14 #include "net/base/net_log.h"
14 15
15 namespace device { 16 namespace device {
16 17
17 class BluetoothProfile; 18 class BluetoothProfile;
18 class BluetoothSocket; 19 class BluetoothSocket;
19 20
20 struct BluetoothOutOfBandPairingData; 21 struct BluetoothOutOfBandPairingData;
21 22
22 // BluetoothDevice represents a remote Bluetooth device, both its properties and 23 // BluetoothDevice represents a remote Bluetooth device, both its properties and
23 // capabilities as discovered by a local adapter and actions that may be 24 // capabilities as discovered by a local adapter and actions that may be
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // all references to the BluetoothSocket are released. Note that the 334 // all references to the BluetoothSocket are released. Note that the
334 // BluetoothSocket object can outlive both this BluetoothDevice and the 335 // BluetoothSocket object can outlive both this BluetoothDevice and the
335 // BluetoothAdapter for this device. 336 // BluetoothAdapter for this device.
336 virtual void ConnectToService(const std::string& service_uuid, 337 virtual void ConnectToService(const std::string& service_uuid,
337 const SocketCallback& callback) = 0; 338 const SocketCallback& callback) = 0;
338 339
339 // Attempts to initiate an outgoing connection to this device for the profile 340 // Attempts to initiate an outgoing connection to this device for the profile
340 // identified by |profile|, on success the profile's connection callback 341 // identified by |profile|, on success the profile's connection callback
341 // will be called as well as |callback|; on failure |error_callback| will be 342 // will be called as well as |callback|; on failure |error_callback| will be
342 // called. 343 // called.
343 virtual void ConnectToProfile(BluetoothProfile* profile, 344 typedef base::Callback<void(const std::string&)>
344 const base::Closure& callback, 345 ConnectToProfileErrorCallback;
345 const ErrorCallback& error_callback) = 0; 346 virtual void ConnectToProfile(
347 BluetoothProfile* profile,
348 const base::Closure& callback,
349 const ConnectToProfileErrorCallback& error_callback) = 0;
346 350
347 // Sets the Out Of Band pairing data for this device to |data|. Exactly one 351 // Sets the Out Of Band pairing data for this device to |data|. Exactly one
348 // of |callback| or |error_callback| will be run. 352 // of |callback| or |error_callback| will be run.
349 virtual void SetOutOfBandPairingData( 353 virtual void SetOutOfBandPairingData(
350 const BluetoothOutOfBandPairingData& data, 354 const BluetoothOutOfBandPairingData& data,
351 const base::Closure& callback, 355 const base::Closure& callback,
352 const ErrorCallback& error_callback) = 0; 356 const ErrorCallback& error_callback) = 0;
353 357
354 // Clears the Out Of Band pairing data for this device. Exactly one of 358 // Clears the Out Of Band pairing data for this device. Exactly one of
355 // |callback| or |error_callback| will be run. 359 // |callback| or |error_callback| will be run.
356 virtual void ClearOutOfBandPairingData( 360 virtual void ClearOutOfBandPairingData(
357 const base::Closure& callback, 361 const base::Closure& callback,
358 const ErrorCallback& error_callback) = 0; 362 const ErrorCallback& error_callback) = 0;
359 363
360 protected: 364 protected:
361 BluetoothDevice(); 365 BluetoothDevice();
362 366
363 // Returns the internal name of the Bluetooth device, used by GetName(). 367 // Returns the internal name of the Bluetooth device, used by GetName().
364 virtual std::string GetDeviceName() const = 0; 368 virtual std::string GetDeviceName() const = 0;
365 369
366 private: 370 private:
367 // Returns a localized string containing the device's bluetooth address and 371 // Returns a localized string containing the device's bluetooth address and
368 // a device type for display when |name_| is empty. 372 // a device type for display when |name_| is empty.
369 base::string16 GetAddressWithLocalizedDeviceTypeName() const; 373 base::string16 GetAddressWithLocalizedDeviceTypeName() const;
370 }; 374 };
371 375
372 } // namespace device 376 } // namespace device
373 377
374 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_ 378 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698