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

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

Issue 2157493003: Revert of bluetooth: Use WebBluetoothDeviceId instead of string (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-uuid-typemap
Patch Set: Created 4 years, 5 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/bluetooth/web_bluetooth_impl.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 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/bluetooth/web_bluetooth_device_id.h"
20 #include "content/common/content_export.h" 19 #include "content/common/content_export.h"
21 #include "mojo/public/cpp/bindings/associated_binding.h" 20 #include "mojo/public/cpp/bindings/associated_binding.h"
22 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h" 21 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
23 #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"
24 23
25 namespace blink { 24 namespace blink {
26 class WebBluetoothRemoteGATTCharacteristic; 25 class WebBluetoothRemoteGATTCharacteristic;
27 } 26 }
28 27
29 namespace shell { 28 namespace shell {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 void registerCharacteristicObject( 81 void registerCharacteristicObject(
83 const blink::WebString& characteristic_instance_id, 82 const blink::WebString& characteristic_instance_id,
84 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override; 83 blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override;
85 84
86 private: 85 private:
87 struct GetCharacteristicsCallback; 86 struct GetCharacteristicsCallback;
88 // WebBluetoothServiceClient methods: 87 // WebBluetoothServiceClient methods:
89 void RemoteCharacteristicValueChanged( 88 void RemoteCharacteristicValueChanged(
90 const mojo::String& characteristic_instance_id, 89 const mojo::String& characteristic_instance_id,
91 mojo::Array<uint8_t> value) override; 90 mojo::Array<uint8_t> value) override;
92 void GattServerDisconnected(const WebBluetoothDeviceId& device_id) override; 91 void GattServerDisconnected(const mojo::String& device_id) override;
93 92
94 // Callbacks for WebBluetoothService calls: 93 // Callbacks for WebBluetoothService calls:
95 void OnRequestDeviceComplete( 94 void OnRequestDeviceComplete(
96 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks, 95 std::unique_ptr<blink::WebBluetoothRequestDeviceCallbacks> callbacks,
97 const blink::mojom::WebBluetoothError error, 96 const blink::mojom::WebBluetoothError error,
98 blink::mojom::WebBluetoothDevicePtr device); 97 blink::mojom::WebBluetoothDevicePtr device);
99 void OnConnectComplete( 98 void OnConnectComplete(
100 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks> 99 std::unique_ptr<blink::WebBluetoothRemoteGATTServerConnectCallbacks>
101 callbacks, 100 callbacks,
102 blink::mojom::WebBluetoothError error); 101 blink::mojom::WebBluetoothError error);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 // Map of characteristic_instance_ids to 135 // Map of characteristic_instance_ids to
137 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is 136 // WebBluetoothRemoteGATTCharacteristics. When characteristicObjectRemoved is
138 // called the characteristic should be removed from the map. 137 // called the characteristic should be removed from the map.
139 // Keeps track of what characteristics have listeners. 138 // Keeps track of what characteristics have listeners.
140 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*> 139 std::unordered_map<std::string, blink::WebBluetoothRemoteGATTCharacteristic*>
141 active_characteristics_; 140 active_characteristics_;
142 141
143 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in 142 // Map of device_ids to WebBluetoothDevices. Added in connect() and removed in
144 // disconnect(). This means a device may not actually be connected while in 143 // disconnect(). This means a device may not actually be connected while in
145 // this map, but that it will definitely be removed when the page navigates. 144 // this map, but that it will definitely be removed when the page navigates.
146 std::unordered_map<WebBluetoothDeviceId, 145 std::unordered_map<std::string, blink::WebBluetoothDevice*>
147 blink::WebBluetoothDevice*,
148 WebBluetoothDeviceIdHash>
149 connected_devices_; 146 connected_devices_;
150 147
151 // Binding associated with |web_bluetooth_service_|. 148 // Binding associated with |web_bluetooth_service_|.
152 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_; 149 mojo::AssociatedBinding<blink::mojom::WebBluetoothServiceClient> binding_;
153 150
154 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl); 151 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl);
155 }; 152 };
156 153
157 } // namespace content 154 } // namespace content
158 155
159 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_ 156 #endif // CONTENT_RENDERER_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/bluetooth/web_bluetooth_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698