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

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

Issue 11075006: Moved bluetooth adapter files to device/bluetooth/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix so that this CL compiles on Windows. Created 8 years, 2 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 | Annotate | Revision Log
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 CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/scoped_vector.h" 13 #include "base/memory/scoped_vector.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/string16.h" 15 #include "base/string16.h"
16 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h"
17 #include "chromeos/dbus/bluetooth_agent_service_provider.h" 16 #include "chromeos/dbus/bluetooth_agent_service_provider.h"
18 #include "chromeos/dbus/bluetooth_device_client.h" 17 #include "chromeos/dbus/bluetooth_device_client.h"
19 #include "dbus/object_path.h" 18 #include "dbus/object_path.h"
19 #include "device/bluetooth/bluetooth_device.h"
20 20
21 namespace chromeos { 21 namespace bluetooth {
keybuk 2012/10/12 00:13:18 namespace?
youngki 2012/10/12 01:50:12 Done.
22 22
23 class BluetoothAdapterChromeOs; 23 class BluetoothAdapterChromeOs;
24 class BluetoothServiceRecord; 24 class BluetoothServiceRecord;
25 25
26 struct BluetoothOutOfBandPairingData; 26 struct BluetoothOutOfBandPairingData;
27 27
28 // The BluetoothDeviceChromeOs class is an implementation of BluetoothDevice 28 // The BluetoothDeviceChromeOs class is an implementation of BluetoothDevice
29 // for Chrome OS platform. 29 // for Chrome OS platform.
30 class BluetoothDeviceChromeOs : public BluetoothDevice, 30 class BluetoothDeviceChromeOs
31 public BluetoothDeviceClient::Observer, 31 : public BluetoothDevice,
32 public BluetoothAgentServiceProvider::Delegate { 32 public chromeos::BluetoothDeviceClient::Observer,
33 public chromeos::BluetoothAgentServiceProvider::Delegate {
33 public: 34 public:
34 virtual ~BluetoothDeviceChromeOs(); 35 virtual ~BluetoothDeviceChromeOs();
35 36
36 // BluetoothDevice override 37 // BluetoothDevice override
37 virtual bool IsPaired() const OVERRIDE; 38 virtual bool IsPaired() const OVERRIDE;
38 virtual const ServiceList& GetServices() const OVERRIDE; 39 virtual const ServiceList& GetServices() const OVERRIDE;
39 virtual void GetServiceRecords( 40 virtual void GetServiceRecords(
40 const ServiceRecordsCallback& callback, 41 const ServiceRecordsCallback& callback,
41 const ErrorCallback& error_callback) OVERRIDE; 42 const ErrorCallback& error_callback) OVERRIDE;
42 virtual bool ProvidesServiceWithUUID(const std::string& uuid) const OVERRIDE; 43 virtual bool ProvidesServiceWithUUID(const std::string& uuid) const OVERRIDE;
(...skipping 13 matching lines...) Expand all
56 virtual void RejectPairing() OVERRIDE; 57 virtual void RejectPairing() OVERRIDE;
57 virtual void CancelPairing() OVERRIDE; 58 virtual void CancelPairing() OVERRIDE;
58 virtual void Disconnect( 59 virtual void Disconnect(
59 const base::Closure& callback, 60 const base::Closure& callback,
60 const ErrorCallback& error_callback) OVERRIDE; 61 const ErrorCallback& error_callback) OVERRIDE;
61 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE; 62 virtual void Forget(const ErrorCallback& error_callback) OVERRIDE;
62 virtual void ConnectToService( 63 virtual void ConnectToService(
63 const std::string& service_uuid, 64 const std::string& service_uuid,
64 const SocketCallback& callback) OVERRIDE; 65 const SocketCallback& callback) OVERRIDE;
65 virtual void SetOutOfBandPairingData( 66 virtual void SetOutOfBandPairingData(
66 const chromeos::BluetoothOutOfBandPairingData& data, 67 const bluetooth::BluetoothOutOfBandPairingData& data,
67 const base::Closure& callback, 68 const base::Closure& callback,
68 const ErrorCallback& error_callback) OVERRIDE; 69 const ErrorCallback& error_callback) OVERRIDE;
69 virtual void ClearOutOfBandPairingData( 70 virtual void ClearOutOfBandPairingData(
70 const base::Closure& callback, 71 const base::Closure& callback,
71 const ErrorCallback& error_callback) OVERRIDE; 72 const ErrorCallback& error_callback) OVERRIDE;
72 73
73 private: 74 private:
74 friend class BluetoothAdapterChromeOs; 75 friend class BluetoothAdapterChromeOs;
75 friend class MockBluetoothDevice; 76 friend class MockBluetoothDevice;
76 77
77 explicit BluetoothDeviceChromeOs(BluetoothAdapterChromeOs* adapter); 78 explicit BluetoothDeviceChromeOs(BluetoothAdapterChromeOs* adapter);
78 79
79 // Sets the dbus object path for the device to |object_path|, indicating 80 // Sets the dbus object path for the device to |object_path|, indicating
80 // that the device has gone from being discovered to paired or bonded. 81 // that the device has gone from being discovered to paired or bonded.
81 void SetObjectPath(const dbus::ObjectPath& object_path); 82 void SetObjectPath(const dbus::ObjectPath& object_path);
82 83
83 // Removes the dbus object path from the device, indicating that the 84 // Removes the dbus object path from the device, indicating that the
84 // device is no longer paired or bonded, but perhaps still visible. 85 // device is no longer paired or bonded, but perhaps still visible.
85 void RemoveObjectPath(); 86 void RemoveObjectPath();
86 87
87 // Sets whether the device is visible to the owning adapter to |visible|. 88 // Sets whether the device is visible to the owning adapter to |visible|.
88 void SetVisible(bool visible) { visible_ = visible; } 89 void SetVisible(bool visible) { visible_ = visible; }
89 90
90 // Updates device information from the properties in |properties|, device 91 // Updates device information from the properties in |properties|, device
91 // state properties such as |paired_| and |connected_| are ignored unless 92 // state properties such as |paired_| and |connected_| are ignored unless
92 // |update_state| is true. 93 // |update_state| is true.
93 void Update(const BluetoothDeviceClient::Properties* properties, 94 void Update(const chromeos::BluetoothDeviceClient::Properties* properties,
94 bool update_state); 95 bool update_state);
95 96
96 // Called by BluetoothAdapterClient when a call to CreateDevice() or 97 // Called by BluetoothAdapterClient when a call to CreateDevice() or
97 // CreatePairedDevice() succeeds, provides the new object path for the remote 98 // CreatePairedDevice() succeeds, provides the new object path for the remote
98 // device in |device_path|. |callback| and |error_callback| are the callbacks 99 // device in |device_path|. |callback| and |error_callback| are the callbacks
99 // provided to Connect(). 100 // provided to Connect().
100 void ConnectCallback(const base::Closure& callback, 101 void ConnectCallback(const base::Closure& callback,
101 const ErrorCallback& error_callback, 102 const ErrorCallback& error_callback,
102 const dbus::ObjectPath& device_path); 103 const dbus::ObjectPath& device_path);
103 104
104 // Called by BluetoothAdapterClient when a call to CreateDevice() or 105 // Called by BluetoothAdapterClient when a call to CreateDevice() or
105 // CreatePairedDevice() fails with the error named |error_name| and 106 // CreatePairedDevice() fails with the error named |error_name| and
106 // optional message |error_message|, |error_callback| is the callback 107 // optional message |error_message|, |error_callback| is the callback
107 // provided to Connect(). 108 // provided to Connect().
108 void ConnectErrorCallback(const ErrorCallback& error_callback, 109 void ConnectErrorCallback(const ErrorCallback& error_callback,
109 const std::string& error_name, 110 const std::string& error_name,
110 const std::string& error_message); 111 const std::string& error_message);
111 112
112 // Called by BluetoothAdapterClient when a call to DiscoverServices() 113 // Called by BluetoothAdapterClient when a call to DiscoverServices()
113 // completes. |callback| and |error_callback| are the callbacks provided to 114 // completes. |callback| and |error_callback| are the callbacks provided to
114 // GetServiceRecords. 115 // GetServiceRecords.
115 void CollectServiceRecordsCallback( 116 void CollectServiceRecordsCallback(
116 const ServiceRecordsCallback& callback, 117 const ServiceRecordsCallback& callback,
117 const ErrorCallback& error_callback, 118 const ErrorCallback& error_callback,
118 const dbus::ObjectPath& device_path, 119 const dbus::ObjectPath& device_path,
119 const BluetoothDeviceClient::ServiceMap& service_map, 120 const chromeos::BluetoothDeviceClient::ServiceMap& service_map,
120 bool success); 121 bool success);
121 122
122 // Called by BluetoothProperty when the call to Set() for the Trusted 123 // Called by BluetoothProperty when the call to Set() for the Trusted
123 // property completes. |success| indicates whether or not the request 124 // property completes. |success| indicates whether or not the request
124 // succeeded, |callback| and |error_callback| are the callbacks provided to 125 // succeeded, |callback| and |error_callback| are the callbacks provided to
125 // Connect(). 126 // Connect().
126 void OnSetTrusted(const base::Closure& callback, 127 void OnSetTrusted(const base::Closure& callback,
127 const ErrorCallback& error_callback, 128 const ErrorCallback& error_callback,
128 bool success); 129 bool success);
129 130
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 // The services (identified by UUIDs) that this device provides. 339 // The services (identified by UUIDs) that this device provides.
339 std::vector<std::string> service_uuids_; 340 std::vector<std::string> service_uuids_;
340 341
341 // During pairing this is set to an object that we don't own, but on which 342 // During pairing this is set to an object that we don't own, but on which
342 // we can make method calls to request, display or confirm PIN Codes and 343 // we can make method calls to request, display or confirm PIN Codes and
343 // Passkeys. Generally it is the object that owns this one. 344 // Passkeys. Generally it is the object that owns this one.
344 BluetoothDevice::PairingDelegate* pairing_delegate_; 345 BluetoothDevice::PairingDelegate* pairing_delegate_;
345 346
346 // During pairing this is set to an instance of a D-Bus agent object 347 // During pairing this is set to an instance of a D-Bus agent object
347 // intialized with our own class as its delegate. 348 // intialized with our own class as its delegate.
348 scoped_ptr<BluetoothAgentServiceProvider> agent_; 349 scoped_ptr<chromeos::BluetoothAgentServiceProvider> agent_;
349 350
350 // During pairing these callbacks are set to those provided by method calls 351 // During pairing these callbacks are set to those provided by method calls
351 // made on us by |agent_| and are called by our own method calls such as 352 // made on us by |agent_| and are called by our own method calls such as
352 // SetPinCode() and SetPasskey(). 353 // SetPinCode() and SetPasskey().
353 PinCodeCallback pincode_callback_; 354 PinCodeCallback pincode_callback_;
354 PasskeyCallback passkey_callback_; 355 PasskeyCallback passkey_callback_;
355 ConfirmationCallback confirmation_callback_; 356 ConfirmationCallback confirmation_callback_;
356 357
357 // Used to keep track of pending application connection requests. 358 // Used to keep track of pending application connection requests.
358 int connecting_applications_counter_; 359 int connecting_applications_counter_;
359 360
360 // Note: This should remain the last member so it'll be destroyed and 361 // Note: This should remain the last member so it'll be destroyed and
361 // invalidate its weak pointers before any other members are destroyed. 362 // invalidate its weak pointers before any other members are destroyed.
362 base::WeakPtrFactory<BluetoothDeviceChromeOs> weak_ptr_factory_; 363 base::WeakPtrFactory<BluetoothDeviceChromeOs> weak_ptr_factory_;
363 364
364 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOs); 365 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOs);
365 }; 366 };
366 367
367 } // namespace chromeos 368 } // namespace bluetooth
368 369
369 #endif // CHROME_BROWSER_CHROMEOS_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_ 370 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698