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

Side by Side Diff: chrome/browser/ui/bluetooth/bluetooth_permission_context.h

Issue 1560263002: Store Bluetooth permissions in website settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleaned up changes at bluetooth_dispatcher_host.cc Created 4 years, 11 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
(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_
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 class BluetoothPermissionContext : public ChooserContextBase {
21 public:
22 explicit BluetoothPermissionContext(Profile* profile);
23 ~BluetoothPermissionContext() override;
24
25 // Grants |requesting_origin| access to the Bluetooth device known as
26 // |device_address| which can be retrieved from
27 // device::BluetoothDevice::GetAddress().
28 void GrantDevicePermission(const GURL& requesting_origin,
29 const GURL& embedding_origin,
30 const std::string& device_address);
31
32 // Revokes |requesting_origin|'s access to the Bluetooth device known as
33 // |device_address| which can be retrieved from
34 // device::BluetoothDevice::GetAddress().
35 void RevokeDevicePermission(const GURL& requesting_origin,
36 const GURL& embedding_origin,
37 const std::string& device_address);
38
39 // Checks if |requesting_origin| (when embedded within |embedding_origin|)
40 // has access to the Bluetooth device known as |device_address| which can be
41 // retrieved from device::BluetoothDevice::GetAddress().
42 std::vector<std::string> HasDevicePermission(
43 const GURL& requesting_origin,
44 const GURL& embedding_origin,
45 const std::string& device_address);
46
47 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
48
49 private:
50 // ChooserContextBase:
51 bool IsValidObject(const base::DictionaryValue& object) override;
52
53 scoped_refptr<device::BluetoothAdapter> adapter_;
54 base::WeakPtrFactory<BluetoothPermissionContext> weak_ptr_factory_;
55
56 DISALLOW_COPY_AND_ASSIGN(BluetoothPermissionContext);
57 };
58
59 #endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698