| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 
| 7 | 7 | 
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" | 
| 9 #include "base/containers/scoped_ptr_map.h" | 9 #include "base/containers/scoped_ptr_map.h" | 
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" | 
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 49   void SetBluetoothAdapterForTesting( | 49   void SetBluetoothAdapterForTesting( | 
| 50       scoped_refptr<device::BluetoothAdapter> mock_adapter); | 50       scoped_refptr<device::BluetoothAdapter> mock_adapter); | 
| 51 | 51 | 
| 52  protected: | 52  protected: | 
| 53   ~BluetoothDispatcherHost() override; | 53   ~BluetoothDispatcherHost() override; | 
| 54 | 54 | 
| 55  private: | 55  private: | 
| 56   friend class base::DeleteHelper<BluetoothDispatcherHost>; | 56   friend class base::DeleteHelper<BluetoothDispatcherHost>; | 
| 57   friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 57   friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; | 
| 58 | 58 | 
|  | 59   struct CacheQueryResult; | 
| 59   struct RequestDeviceSession; | 60   struct RequestDeviceSession; | 
| 60 | 61 | 
| 61   // Set |adapter_| to a BluetoothAdapter instance and register observers, | 62   // Set |adapter_| to a BluetoothAdapter instance and register observers, | 
| 62   // releasing references to previous |adapter_|. | 63   // releasing references to previous |adapter_|. | 
| 63   void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter); | 64   void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter); | 
| 64 | 65 | 
| 65   // Makes sure a BluetoothDiscoverySession is active for |session|, and resets | 66   // Makes sure a BluetoothDiscoverySession is active for |session|, and resets | 
| 66   // its timeout. | 67   // its timeout. | 
| 67   void StartDeviceDiscovery(RequestDeviceSession* session, int chooser_id); | 68   void StartDeviceDiscovery(RequestDeviceSession* session, int chooser_id); | 
| 68 | 69 | 
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 188   void OnStartNotifySessionFailed( | 189   void OnStartNotifySessionFailed( | 
| 189       int thread_id, | 190       int thread_id, | 
| 190       int request_id, | 191       int request_id, | 
| 191       device::BluetoothGattService::GattErrorCode error_code); | 192       device::BluetoothGattService::GattErrorCode error_code); | 
| 192 | 193 | 
| 193   // Callback for BluetoothGattNotifySession::Stop. | 194   // Callback for BluetoothGattNotifySession::Stop. | 
| 194   void OnStopNotifySession(int thread_id, | 195   void OnStopNotifySession(int thread_id, | 
| 195                            int request_id, | 196                            int request_id, | 
| 196                            const std::string& characteristic_instance_id); | 197                            const std::string& characteristic_instance_id); | 
| 197 | 198 | 
|  | 199   // Functions to query the platform cache for the bluetooth object. | 
|  | 200   // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the | 
|  | 201   // cache. Otherwise result.outcome that can used to record the outcome and | 
|  | 202   // result.error will contain the error that should be send to the renderer. | 
|  | 203   // One of the possible outcomes is BAD_RENDERER. In this case the outcome | 
|  | 204   // was already recorded and since there renderer crashed there is no need to | 
|  | 205   // send a response. | 
|  | 206 | 
|  | 207   // Queries the platform cache for a Device with |device_instance_id|. If | 
|  | 208   // successful the device will be in result.device | 
|  | 209   void QueryCacheForDevice(const std::string& device_instance_id, | 
|  | 210                            CacheQueryResult& result); | 
|  | 211   // Queries the platform cache for a Service with |service_instance_id|. | 
|  | 212   // If successfull the service will be in result.service. | 
|  | 213   void QueryCacheForService(const std::string& service_instance_id, | 
|  | 214                             CacheQueryResult& result); | 
|  | 215   // Queries the platform cache for a characteristic with | 
|  | 216   // |characteristic_instance_id|. If successfull the characteristic will be in | 
|  | 217   // result.characteristic. | 
|  | 218   void QueryCacheForCharacteristic( | 
|  | 219       const std::string& characteristic_instance_id, | 
|  | 220       CacheQueryResult& result); | 
|  | 221 | 
| 198   // Show help pages from the chooser dialog. | 222   // Show help pages from the chooser dialog. | 
| 199   void ShowBluetoothOverviewLink(); | 223   void ShowBluetoothOverviewLink(); | 
| 200   void ShowBluetoothPairingLink(); | 224   void ShowBluetoothPairingLink(); | 
| 201   void ShowBluetoothAdapterOffLink(); | 225   void ShowBluetoothAdapterOffLink(); | 
| 202 | 226 | 
| 203   int render_process_id_; | 227   int render_process_id_; | 
| 204 | 228 | 
| 205   // Maps a (thread_id,request_id) to information about its requestDevice call, | 229   // Maps a (thread_id,request_id) to information about its requestDevice call, | 
| 206   // including the chooser dialog. | 230   // including the chooser dialog. | 
| 207   // An entry is added to this map in OnRequestDevice, and should be removed | 231   // An entry is added to this map in OnRequestDevice, and should be removed | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 248   // copies verify they are also used on the UI thread. | 272   // copies verify they are also used on the UI thread. | 
| 249   base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; | 273   base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; | 
| 250   base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 274   base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 
| 251 | 275 | 
| 252   DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 276   DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 
| 253 }; | 277 }; | 
| 254 | 278 | 
| 255 }  // namespace content | 279 }  // namespace content | 
| 256 | 280 | 
| 257 #endif  // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 281 #endif  // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 
| OLD | NEW | 
|---|