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

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

Issue 276573004: Bluetooth: Implement new socket API for Chrome OS (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DCHECK nits Created 6 years, 7 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
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ADAPTER_CHROMEOS_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <string> 9 #include <string>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 int channel, 71 int channel,
72 bool insecure, 72 bool insecure,
73 const CreateServiceCallback& callback, 73 const CreateServiceCallback& callback,
74 const CreateServiceErrorCallback& error_callback) OVERRIDE; 74 const CreateServiceErrorCallback& error_callback) OVERRIDE;
75 virtual void CreateL2capService( 75 virtual void CreateL2capService(
76 const device::BluetoothUUID& uuid, 76 const device::BluetoothUUID& uuid,
77 int psm, 77 int psm,
78 const CreateServiceCallback& callback, 78 const CreateServiceCallback& callback,
79 const CreateServiceErrorCallback& error_callback) OVERRIDE; 79 const CreateServiceErrorCallback& error_callback) OVERRIDE;
80 80
81 // Locates the device object by object path (the devices map and
82 // BluetoothDevice methods are by address).
83 BluetoothDeviceChromeOS* GetDeviceWithPath(
84 const dbus::ObjectPath& object_path);
85
86 // Announce to observers a change in device state that is not reflected by
87 // its D-Bus properties.
88 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device);
89
90 // Returns the object path of the adapter.
91 const dbus::ObjectPath& object_path() const { return object_path_; }
92
81 protected: 93 protected:
82 // BluetoothAdapter: 94 // BluetoothAdapter:
83 virtual void RemovePairingDelegateInternal( 95 virtual void RemovePairingDelegateInternal(
84 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE; 96 device::BluetoothDevice::PairingDelegate* pairing_delegate) OVERRIDE;
85 97
86 private: 98 private:
87 friend class BluetoothChromeOSTest; 99 friend class BluetoothChromeOSTest;
88 friend class BluetoothDeviceChromeOS;
89 friend class BluetoothProfileChromeOS;
90 friend class BluetoothProfileChromeOSTest;
91 100
92 // typedef for callback parameters that are passed to AddDiscoverySession 101 // typedef for callback parameters that are passed to AddDiscoverySession
93 // and RemoveDiscoverySession. This is used to queue incoming requests while 102 // and RemoveDiscoverySession. This is used to queue incoming requests while
94 // a call to BlueZ is pending. 103 // a call to BlueZ is pending.
95 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair; 104 typedef std::pair<base::Closure, ErrorCallback> DiscoveryCallbackPair;
96 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue; 105 typedef std::queue<DiscoveryCallbackPair> DiscoveryCallbackQueue;
97 106
98 BluetoothAdapterChromeOS(); 107 BluetoothAdapterChromeOS();
99 virtual ~BluetoothAdapterChromeOS(); 108 virtual ~BluetoothAdapterChromeOS();
100 109
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 void OnRegisterAgent(); 151 void OnRegisterAgent();
143 void OnRegisterAgentError(const std::string& error_name, 152 void OnRegisterAgentError(const std::string& error_name,
144 const std::string& error_message); 153 const std::string& error_message);
145 154
146 // Called by dbus:: on completion of the D-Bus method call to request that 155 // Called by dbus:: on completion of the D-Bus method call to request that
147 // the pairing agent be made the default. 156 // the pairing agent be made the default.
148 void OnRequestDefaultAgent(); 157 void OnRequestDefaultAgent();
149 void OnRequestDefaultAgentError(const std::string& error_name, 158 void OnRequestDefaultAgentError(const std::string& error_name,
150 const std::string& error_message); 159 const std::string& error_message);
151 160
152 // Internal method used to locate the device object by object path
153 // (the devices map and BluetoothDevice methods are by address)
154 BluetoothDeviceChromeOS* GetDeviceWithPath(
155 const dbus::ObjectPath& object_path);
156
157 // Internal method to obtain a BluetoothPairingChromeOS object for the device 161 // Internal method to obtain a BluetoothPairingChromeOS object for the device
158 // with path |object_path|. Returns the existing pairing object if the device 162 // with path |object_path|. Returns the existing pairing object if the device
159 // already has one (usually an outgoing connection in progress) or a new 163 // already has one (usually an outgoing connection in progress) or a new
160 // pairing object with the default pairing delegate if not. If no default 164 // pairing object with the default pairing delegate if not. If no default
161 // pairing object exists, NULL will be returned. 165 // pairing object exists, NULL will be returned.
162 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path); 166 BluetoothPairingChromeOS* GetPairing(const dbus::ObjectPath& object_path);
163 167
164 // Set the tracked adapter to the one in |object_path|, this object will 168 // Set the tracked adapter to the one in |object_path|, this object will
165 // subsequently operate on that adapter until it is removed. 169 // subsequently operate on that adapter until it is removed.
166 void SetAdapter(const dbus::ObjectPath& object_path); 170 void SetAdapter(const dbus::ObjectPath& object_path);
167 171
168 // Set the adapter name to one chosen from the system information. 172 // Set the adapter name to one chosen from the system information.
169 void SetDefaultAdapterName(); 173 void SetDefaultAdapterName();
170 174
171 // Remove the currently tracked adapter. IsPresent() will return false after 175 // Remove the currently tracked adapter. IsPresent() will return false after
172 // this is called. 176 // this is called.
173 void RemoveAdapter(); 177 void RemoveAdapter();
174 178
175 // Announce to observers a change in the adapter state. 179 // Announce to observers a change in the adapter state.
176 void PoweredChanged(bool powered); 180 void PoweredChanged(bool powered);
177 void DiscoverableChanged(bool discoverable); 181 void DiscoverableChanged(bool discoverable);
178 void DiscoveringChanged(bool discovering); 182 void DiscoveringChanged(bool discovering);
179 void PresentChanged(bool present); 183 void PresentChanged(bool present);
180 184
181 // Announce to observers a change in device state that is not reflected by
182 // its D-Bus properties.
183 void NotifyDeviceChanged(BluetoothDeviceChromeOS* device);
184
185 // Called by dbus:: on completion of the discoverable property change. 185 // Called by dbus:: on completion of the discoverable property change.
186 void OnSetDiscoverable(const base::Closure& callback, 186 void OnSetDiscoverable(const base::Closure& callback,
187 const ErrorCallback& error_callback, 187 const ErrorCallback& error_callback,
188 bool success); 188 bool success);
189 189
190 // Called by dbus:: on completion of an adapter property change. 190 // Called by dbus:: on completion of an adapter property change.
191 void OnPropertyChangeCompleted(const base::Closure& callback, 191 void OnPropertyChangeCompleted(const base::Closure& callback,
192 const ErrorCallback& error_callback, 192 const ErrorCallback& error_callback,
193 bool success); 193 bool success);
194 194
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // Note: This should remain the last member so it'll be destroyed and 253 // Note: This should remain the last member so it'll be destroyed and
254 // invalidate its weak pointers before any other members are destroyed. 254 // invalidate its weak pointers before any other members are destroyed.
255 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; 255 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_;
256 256
257 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); 257 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS);
258 }; 258 };
259 259
260 } // namespace chromeos 260 } // namespace chromeos
261 261
262 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ 262 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth.gyp ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698