OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_ | |
Jeffrey Yasskin
2016/01/21 00:32:30
This couple files don't seem like UI code, so they
juncai
2016/01/25 18:53:32
Done.
| |
6 #define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_ | |
7 | |
8 #include <string> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/memory/ref_counted.h" | |
13 #include "base/memory/weak_ptr.h" | |
14 #include "chrome/browser/permissions/chooser_context_base.h" | |
15 | |
16 namespace device { | |
17 class BluetoothAdapter; | |
18 } | |
19 | |
20 namespace url { | |
21 class Origin; | |
22 } | |
23 | |
24 class BluetoothPermissionContext : public ChooserContextBase { | |
25 public: | |
26 explicit BluetoothPermissionContext(Profile* profile); | |
27 ~BluetoothPermissionContext() override; | |
28 | |
29 // Grants |requesting_origin| access to the Bluetooth device known as | |
30 // |device_address| which can be retrieved from | |
31 // device::BluetoothDevice::GetAddress(). | |
32 void GrantDevicePermission(const url::Origin& requesting_origin, | |
33 const url::Origin& embedding_origin, | |
34 const std::string& device_address); | |
35 | |
36 // Revokes |requesting_origin|'s access to the Bluetooth device known as | |
37 // |device_address| which can be retrieved from | |
38 // device::BluetoothDevice::GetAddress(). | |
39 void RevokeDevicePermission(const url::Origin& requesting_origin, | |
40 const url::Origin& embedding_origin, | |
41 const std::string& device_address); | |
42 | |
43 // Checks if |requesting_origin| (when embedded within |embedding_origin|) | |
44 // has access to the Bluetooth device known as |device_address| which can be | |
45 // retrieved from device::BluetoothDevice::GetAddress(). | |
46 std::vector<std::string> HasDevicePermission( | |
Jeffrey Yasskin
2016/01/21 00:32:30
A non-boolean function shouldn't be named Has*. Th
juncai
2016/01/25 18:53:32
This function is removed since it is not used by o
| |
47 const url::Origin& requesting_origin, | |
48 const url::Origin& embedding_origin, | |
49 const std::string& device_address); | |
50 | |
51 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | |
Jeffrey Yasskin
2016/01/21 00:32:30
I believe this can be private.
juncai
2016/01/25 18:53:32
This function is removed since the permission obje
| |
52 | |
53 private: | |
54 // ChooserContextBase: | |
55 bool IsValidObject(const base::DictionaryValue& object) override; | |
56 | |
57 scoped_refptr<device::BluetoothAdapter> adapter_; | |
58 base::WeakPtrFactory<BluetoothPermissionContext> weak_ptr_factory_; | |
59 | |
60 DISALLOW_COPY_AND_ASSIGN(BluetoothPermissionContext); | |
61 }; | |
62 | |
63 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_ | |
OLD | NEW |