Roll breakpad a513e85:7caf028 (svn 1384:1385)
[chromium-blink-merge.git] / device / bluetooth / bluetooth_gatt_connection_chromeos.h
blobbeade19d17bf76088d99a6d5046a5132e8e30703
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chromeos/dbus/bluetooth_device_client.h"
13 #include "dbus/object_path.h"
14 #include "device/bluetooth/bluetooth_gatt_connection.h"
16 namespace device {
18 class BluetoothAdapter;
20 } // namespace device
22 namespace chromeos {
24 // BluetoothGattConnectionChromeOS implements BluetoothGattConnection for the
25 // Chrome OS platform.
26 class BluetoothGattConnectionChromeOS
27 : public device::BluetoothGattConnection,
28 public BluetoothDeviceClient::Observer {
29 public:
30 explicit BluetoothGattConnectionChromeOS(
31 scoped_refptr<device::BluetoothAdapter> adapter,
32 const std::string& device_address,
33 const dbus::ObjectPath& object_path);
34 virtual ~BluetoothGattConnectionChromeOS();
36 // BluetoothGattConnection overrides.
37 virtual std::string GetDeviceAddress() const OVERRIDE;
38 virtual bool IsConnected() OVERRIDE;
39 virtual void Disconnect(const base::Closure& callback) OVERRIDE;
41 private:
43 // chromeos::BluetoothDeviceClient::Observer overrides.
44 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) OVERRIDE;
45 virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path,
46 const std::string& property_name) OVERRIDE;
48 // True, if the connection is currently active.
49 bool connected_;
51 // The Bluetooth adapter that this connection is associated with.
52 scoped_refptr<device::BluetoothAdapter> adapter_;
54 // Bluetooth address of the underlying device.
55 std::string device_address_;
57 // D-Bus object path of the underlying device. This is used to filter observer
58 // events.
59 dbus::ObjectPath object_path_;
61 DISALLOW_COPY_AND_ASSIGN(BluetoothGattConnectionChromeOS);
64 } // namespace chromeos
66 #endif // DEVICE_BLUETOOTH_BLUETOOTH_GATT_CONNECTION_CHROMEOS_H_