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

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

Issue 2658473002: Refactor BluetoothAllowedDevicesMap (Closed)
Patch Set: cleaned up layout test code Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_WEB_BLUETOOTH_SERVICE_IMPL_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/optional.h" 13 #include "base/optional.h"
14 #include "content/browser/bad_message.h" 14 #include "content/browser/bad_message.h"
15 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" 15 #include "content/browser/bluetooth/bluetooth_allowed_devices.h"
16 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
17 #include "content/public/browser/web_contents_observer.h" 17 #include "content/public/browser/web_contents_observer.h"
18 #include "device/bluetooth/bluetooth_adapter.h" 18 #include "device/bluetooth/bluetooth_adapter.h"
19 #include "device/bluetooth/bluetooth_gatt_connection.h" 19 #include "device/bluetooth/bluetooth_gatt_connection.h"
20 #include "device/bluetooth/bluetooth_gatt_notify_session.h" 20 #include "device/bluetooth/bluetooth_gatt_notify_session.h"
21 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" 21 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h"
22 #include "device/bluetooth/bluetooth_remote_gatt_service.h" 22 #include "device/bluetooth/bluetooth_remote_gatt_service.h"
23 #include "mojo/public/cpp/bindings/binding.h" 23 #include "mojo/public/cpp/bindings/binding.h"
24 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 24 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
25 25
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 // Queries the platform cache for a descriptor with |descriptor_instance_id|. 242 // Queries the platform cache for a descriptor with |descriptor_instance_id|.
243 // Fills in the |outcome| field, and |device|, |service|, |characteristic|, 243 // Fills in the |outcome| field, and |device|, |service|, |characteristic|,
244 // |descriptor| fields if successful. 244 // |descriptor| fields if successful.
245 CacheQueryResult QueryCacheForDescriptor( 245 CacheQueryResult QueryCacheForDescriptor(
246 const std::string& descriptor_instance_id); 246 const std::string& descriptor_instance_id);
247 247
248 RenderProcessHost* GetRenderProcessHost(); 248 RenderProcessHost* GetRenderProcessHost();
249 device::BluetoothAdapter* GetAdapter(); 249 device::BluetoothAdapter* GetAdapter();
250 url::Origin GetOrigin(); 250 url::Origin GetOrigin();
251 BluetoothAllowedDevices& allowed_devices();
251 252
252 // Clears all state (maps, sets, etc). 253 // Clears all state (maps, sets, etc).
253 void ClearState(); 254 void ClearState();
254 255
255 // Used to open a BluetoothChooser and start a device discovery session. 256 // Used to open a BluetoothChooser and start a device discovery session.
256 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_; 257 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_;
257 258
258 // Keeps track of which devices the frame's origin is allowed to access.
259 BluetoothAllowedDevicesMap allowed_devices_map_;
260
261 // Maps to get the object's parent based on its instanceID. 259 // Maps to get the object's parent based on its instanceID.
262 std::unordered_map<std::string, std::string> service_id_to_device_address_; 260 std::unordered_map<std::string, std::string> service_id_to_device_address_;
263 std::unordered_map<std::string, std::string> characteristic_id_to_service_id_; 261 std::unordered_map<std::string, std::string> characteristic_id_to_service_id_;
264 std::unordered_map<std::string, std::string> 262 std::unordered_map<std::string, std::string>
265 descriptor_id_to_characteristic_id_; 263 descriptor_id_to_characteristic_id_;
266 264
267 // Map to keep track of the connected Bluetooth devices. 265 // Map to keep track of the connected Bluetooth devices.
268 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_; 266 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_;
269 267
270 // Maps a device address to callbacks that are waiting for services to 268 // Maps a device address to callbacks that are waiting for services to
(...skipping 18 matching lines...) Expand all
289 mojo::Binding<blink::mojom::WebBluetoothService> binding_; 287 mojo::Binding<blink::mojom::WebBluetoothService> binding_;
290 288
291 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; 289 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_;
292 290
293 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); 291 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl);
294 }; 292 };
295 293
296 } // namespace content 294 } // namespace content
297 295
298 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ 296 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698