Index: chrome/browser/ui/bluetooth/bluetooth_permission_context.h |
diff --git a/chrome/browser/ui/bluetooth/bluetooth_permission_context.h b/chrome/browser/ui/bluetooth/bluetooth_permission_context.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d4ecfb4749274167f07e0cc39dc13230b969b099 |
--- /dev/null |
+++ b/chrome/browser/ui/bluetooth/bluetooth_permission_context.h |
@@ -0,0 +1,63 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#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.
|
+#define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_ |
+ |
+#include <string> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/memory/ref_counted.h" |
+#include "base/memory/weak_ptr.h" |
+#include "chrome/browser/permissions/chooser_context_base.h" |
+ |
+namespace device { |
+class BluetoothAdapter; |
+} |
+ |
+namespace url { |
+class Origin; |
+} |
+ |
+class BluetoothPermissionContext : public ChooserContextBase { |
+ public: |
+ explicit BluetoothPermissionContext(Profile* profile); |
+ ~BluetoothPermissionContext() override; |
+ |
+ // Grants |requesting_origin| access to the Bluetooth device known as |
+ // |device_address| which can be retrieved from |
+ // device::BluetoothDevice::GetAddress(). |
+ void GrantDevicePermission(const url::Origin& requesting_origin, |
+ const url::Origin& embedding_origin, |
+ const std::string& device_address); |
+ |
+ // Revokes |requesting_origin|'s access to the Bluetooth device known as |
+ // |device_address| which can be retrieved from |
+ // device::BluetoothDevice::GetAddress(). |
+ void RevokeDevicePermission(const url::Origin& requesting_origin, |
+ const url::Origin& embedding_origin, |
+ const std::string& device_address); |
+ |
+ // Checks if |requesting_origin| (when embedded within |embedding_origin|) |
+ // has access to the Bluetooth device known as |device_address| which can be |
+ // retrieved from device::BluetoothDevice::GetAddress(). |
+ 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
|
+ const url::Origin& requesting_origin, |
+ const url::Origin& embedding_origin, |
+ const std::string& device_address); |
+ |
+ 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
|
+ |
+ private: |
+ // ChooserContextBase: |
+ bool IsValidObject(const base::DictionaryValue& object) override; |
+ |
+ scoped_refptr<device::BluetoothAdapter> adapter_; |
+ base::WeakPtrFactory<BluetoothPermissionContext> weak_ptr_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BluetoothPermissionContext); |
+}; |
+ |
+#endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_PERMISSION_CONTEXT_H_ |