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

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

Issue 2459523002: bluetooth: Return specific error if getPrimaryServices() is called without requesting access to any… (Closed)
Patch Set: s/foo/TestName/ Created 4 years, 1 month 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 | « no previous file | content/browser/bluetooth/bluetooth_allowed_devices_map.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_ALLOWED_DEVICES_MAP_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_H_
6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // Returns the Bluetooth Device's id for |origin| if |origin| is allowed to 50 // Returns the Bluetooth Device's id for |origin| if |origin| is allowed to
51 // access the device. 51 // access the device.
52 const WebBluetoothDeviceId* GetDeviceId(const url::Origin& origin, 52 const WebBluetoothDeviceId* GetDeviceId(const url::Origin& origin,
53 const std::string& device_address); 53 const std::string& device_address);
54 54
55 // For |device_id| in |origin|, returns the Bluetooth device's address. If 55 // For |device_id| in |origin|, returns the Bluetooth device's address. If
56 // there is no such |device_id| in |origin|, returns an empty string. 56 // there is no such |device_id| in |origin|, returns an empty string.
57 const std::string& GetDeviceAddress(const url::Origin& origin, 57 const std::string& GetDeviceAddress(const url::Origin& origin,
58 const WebBluetoothDeviceId& device_id); 58 const WebBluetoothDeviceId& device_id);
59 59
60 // Returns true if the origin has previously been granted access to at least
61 // one service.
62 bool IsOriginAllowedToAccessAtLeastOneService(
63 const url::Origin& origin,
64 const WebBluetoothDeviceId& device_id) const;
65
60 // Returns true if the origin has previously been granted access to 66 // Returns true if the origin has previously been granted access to
61 // the service. 67 // the service.
62 bool IsOriginAllowedToAccessService( 68 bool IsOriginAllowedToAccessService(
63 const url::Origin& origin, 69 const url::Origin& origin,
64 const WebBluetoothDeviceId& device_id, 70 const WebBluetoothDeviceId& device_id,
65 const device::BluetoothUUID& service_uuid) const; 71 const device::BluetoothUUID& service_uuid) const;
66 72
67 private: 73 private:
68 typedef std::unordered_map<std::string, WebBluetoothDeviceId> 74 typedef std::unordered_map<std::string, WebBluetoothDeviceId>
69 DeviceAddressToIdMap; 75 DeviceAddressToIdMap;
(...skipping 27 matching lines...) Expand all
97 origin_to_device_id_to_services_map_; 103 origin_to_device_id_to_services_map_;
98 104
99 // Keep track of all device_ids in the map. 105 // Keep track of all device_ids in the map.
100 std::unordered_set<WebBluetoothDeviceId, WebBluetoothDeviceIdHash> 106 std::unordered_set<WebBluetoothDeviceId, WebBluetoothDeviceIdHash>
101 device_id_set_; 107 device_id_set_;
102 }; 108 };
103 109
104 } // namespace content 110 } // namespace content
105 111
106 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_H_ 112 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_ALLOWED_DEVICES_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/bluetooth/bluetooth_allowed_devices_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698