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

Side by Side Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1120373004: bluetooth: Browser-side implementation of connectGATT. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-request-device-implementation
Patch Set: Created 5 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
OLDNEW
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/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "content/common/bluetooth/bluetooth_error.h" 10 #include "content/common/bluetooth/bluetooth_error.h"
11 #include "content/public/browser/browser_message_filter.h" 11 #include "content/public/browser/browser_message_filter.h"
12 #include "device/bluetooth/bluetooth_adapter.h" 12 #include "device/bluetooth/bluetooth_adapter.h"
13 #include "device/bluetooth/bluetooth_gatt_connection.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 // Dispatches and sends bluetooth related messages sent to/from a child 17 // Dispatches and sends bluetooth related messages sent to/from a child
17 // process BluetoothDispatcher from/to the main browser process. 18 // process BluetoothDispatcher from/to the main browser process.
18 // 19 //
19 // Intended to be instantiated by the RenderProcessHost and installed as 20 // Intended to be instantiated by the RenderProcessHost and installed as
20 // a filter on the channel. BrowserMessageFilter is refcounted and typically 21 // a filter on the channel. BrowserMessageFilter is refcounted and typically
21 // lives as long as it is installed on a channel. 22 // lives as long as it is installed on a channel.
22 // 23 //
(...skipping 19 matching lines...) Expand all
42 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 43 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
43 44
44 // Set |adapter_| to a BluetoothAdapter instance and register observers, 45 // Set |adapter_| to a BluetoothAdapter instance and register observers,
45 // releasing references to previous |adapter_|. 46 // releasing references to previous |adapter_|.
46 void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter); 47 void set_adapter(scoped_refptr<device::BluetoothAdapter> adapter);
47 48
48 // IPC Handlers, see definitions in bluetooth_messages.h. 49 // IPC Handlers, see definitions in bluetooth_messages.h.
49 void OnRequestDevice(int thread_id, int request_id); 50 void OnRequestDevice(int thread_id, int request_id);
50 void OnConnectGATT(int thread_id, int request_id, 51 void OnConnectGATT(int thread_id, int request_id,
51 const std::string& device_instance_id); 52 const std::string& device_instance_id);
53
scheib 2015/05/05 04:00:43 ?
52 void OnSetBluetoothMockDataSetForTesting(const std::string& name); 54 void OnSetBluetoothMockDataSetForTesting(const std::string& name);
53 55
54 // Callbacks for BluetoothAdapter::StartDiscoverySession. 56 // Callbacks for BluetoothAdapter::StartDiscoverySession.
55 void OnDiscoverySessionStarted( 57 void OnDiscoverySessionStarted(
56 int thread_id, 58 int thread_id,
57 int request_id, 59 int request_id,
58 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 60 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
59 void OnDiscoverySessionStartedError(int thread_id, int request_id); 61 void OnDiscoverySessionStartedError(int thread_id, int request_id);
60 62
61 // Stop in progress discovery session. 63 // Stop in progress discovery session.
62 void StopDiscoverySession( 64 void StopDiscoverySession(
63 int thread_id, 65 int thread_id,
64 int request_id, 66 int request_id,
65 scoped_ptr<device::BluetoothDiscoverySession> discovery_session); 67 scoped_ptr<device::BluetoothDiscoverySession> discovery_session);
66 68
67 // Callbacks for BluetoothDiscoverySession::Stop. 69 // Callbacks for BluetoothDiscoverySession::Stop.
68 void OnDiscoverySessionStopped(int thread_id, int request_id); 70 void OnDiscoverySessionStopped(int thread_id, int request_id);
69 void OnDiscoverySessionStoppedError(int thread_id, int request_id); 71 void OnDiscoverySessionStoppedError(int thread_id, int request_id);
70 72
73 // Callbacks for BluetoothDevice::CreateGattConnection
74 void OnGATTConnectionCreated(
75 int thread_id,
76 int request_id,
77 const std::string& device_instance_id,
78 scoped_ptr<device::BluetoothGattConnection> connection);
79 void OnCreateGATTConnectionError(
80 int thread_id,
81 int request_id,
82 const std::string& device_instance_id,
83 device::BluetoothDevice::ConnectErrorCode error_code);
84
71 // A BluetoothAdapter instance representing an adapter of the system. 85 // A BluetoothAdapter instance representing an adapter of the system.
72 scoped_refptr<device::BluetoothAdapter> adapter_; 86 scoped_refptr<device::BluetoothAdapter> adapter_;
73 87
74 enum class MockData { NOT_MOCKING, REJECT, RESOLVE }; 88 enum class MockData { NOT_MOCKING, REJECT, RESOLVE };
75 MockData bluetooth_mock_data_set_; 89 MockData bluetooth_mock_data_set_;
76 BluetoothError bluetooth_request_device_reject_type_; 90 BluetoothError bluetooth_request_device_reject_type_;
77 91
78 // Must be last member, see base/memory/weak_ptr.h documentation 92 // Must be last member, see base/memory/weak_ptr.h documentation
79 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; 93 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_;
80 94
81 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); 95 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost);
82 }; 96 };
83 97
84 } // namespace content 98 } // namespace content
85 99
86 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ 100 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698