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

Side by Side Diff: content/renderer/bluetooth/web_bluetooth_impl.h

Issue 2079943002: Change RenderFrame to use InterfaceRegistry et al. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a2
Patch Set: . Created 4 years, 6 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_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ 5 #ifndef CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ 6 #define CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <unordered_map> 12 #include <unordered_map>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
19 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
20 #include "mojo/public/cpp/bindings/associated_binding.h" 20 #include "mojo/public/cpp/bindings/associated_binding.h"
21 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h" 21 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
22 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 22 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
23 23
24 namespace blink { 24 namespace blink {
25 class WebBluetoothRemoteGATTCharacteristic; 25 class WebBluetoothRemoteGATTCharacteristic;
26 } 26 }
27 27
28 namespace shell {
29 class InterfaceProvider;
30 }
31
28 namespace content { 32 namespace content {
29 33
30 class BluetoothDispatcher; 34 class BluetoothDispatcher;
31 class ThreadSafeSender; 35 class ThreadSafeSender;
32 class ServiceRegistry;
33 36
34 // Implementation of blink::WebBluetooth. Passes calls through to the thread 37 // Implementation of blink::WebBluetooth. Passes calls through to the thread
35 // specific BluetoothDispatcher. 38 // specific BluetoothDispatcher.
36 class CONTENT_EXPORT WebBluetoothImpl 39 class CONTENT_EXPORT WebBluetoothImpl
37 : NON_EXPORTED_BASE(public blink::mojom::WebBluetoothServiceClient), 40 : NON_EXPORTED_BASE(public blink::mojom::WebBluetoothServiceClient),
38 NON_EXPORTED_BASE(public blink::WebBluetooth) { 41 NON_EXPORTED_BASE(public blink::WebBluetooth) {
39 public: 42 public:
40 WebBluetoothImpl(ServiceRegistry* service_registry); 43 WebBluetoothImpl(shell::InterfaceProvider* remote_interfaces);
41 ~WebBluetoothImpl() override; 44 ~WebBluetoothImpl() override;
42 45
43 // blink::WebBluetooth interface: 46 // blink::WebBluetooth interface:
44 void requestDevice( 47 void requestDevice(
45 const blink::WebRequestDeviceOptions& options, 48 const blink::WebRequestDeviceOptions& options,
46 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override; 49 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override;
47 void connect( 50 void connect(
48 const blink::WebString& device_id, 51 const blink::WebString& device_id,
49 blink::WebBluetoothDevice* device, 52 blink::WebBluetoothDevice* device,
50 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override; 53 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks, 120 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks,
118 blink::mojom::WebBluetoothError error); 121 blink::mojom::WebBluetoothError error);
119 void OnStopNotificationsComplete( 122 void OnStopNotificationsComplete(
120 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks); 123 std::unique_ptr<blink::WebBluetoothNotificationsCallbacks> callbacks);
121 124
122 void DispatchCharacteristicValueChanged( 125 void DispatchCharacteristicValueChanged(
123 const std::string& characteristic_instance_id, 126 const std::string& characteristic_instance_id,
124 const std::vector<uint8_t>& value); 127 const std::vector<uint8_t>& value);
125 128
126 blink::mojom::WebBluetoothService& GetWebBluetoothService(); 129 blink::mojom::WebBluetoothService& GetWebBluetoothService();
127 ServiceRegistry* const service_registry_; 130 shell::InterfaceProvider* const remote_interfaces_;
128 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_; 131 blink::mojom::WebBluetoothServicePtr web_bluetooth_service_;
129 132
130 // Map of characteristic_instance_ids to 133 // Map of characteristic_instance_ids to
131 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is 134 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is
132 // called the characteristic should be removed from the map. 135 // called the characteristic should be removed from the map.
133 // Keeps track of what characteristics have listeners. 136 // Keeps track of what characteristics have listeners.
134 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> 137 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*>
135 active_characteristics_; 138 active_characteristics_;
136 139
137 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in 140 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in
138 // disconnect(). This means a device may not actually be connected while in 141 // disconnect(). This means a device may not actually be connected while in
139 // this map, but that it will definitely be removed when the page navigates. 142 // this map, but that it will definitely be removed when the page navigates.
140 std::unordered_map<std::string, blink::WebBluetoothDevice*> 143 std::unordered_map<std::string, blink::WebBluetoothDevice*>
141 connected_devices_; 144 connected_devices_;
142 145
143 // Binding associated with |web_bluetooth_service_|. 146 // Binding associated with |web_bluetooth_service_|.
144 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; 147 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_;
145 148
146 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); 149 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl);
147 }; 150 };
148 151
149 } // namespace content 152 } // namespace content
150 153
151 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ 154 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
OLDNEW
« no previous file with comments | « content/public/utility/content_utility_client.h ('k') | content/renderer/bluetooth/web_bluetooth_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698