Chromium Code Reviews| Index: chrome/browser/ui/bluetooth/bluetooth_chooser_context.h |
| diff --git a/chrome/browser/ui/bluetooth/bluetooth_chooser_context.h b/chrome/browser/ui/bluetooth/bluetooth_chooser_context.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4b99dde165918da5c4150c00e668e934630eba38 |
| --- /dev/null |
| +++ b/chrome/browser/ui/bluetooth/bluetooth_chooser_context.h |
| @@ -0,0 +1,43 @@ |
| +// 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_CHOOSER_CONTEXT_H_ |
| +#define CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTEXT_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "chrome/browser/permissions/chooser_context_base.h" |
| + |
| +class BluetoothChooserContext : public ChooserContextBase { |
|
Jeffrey Yasskin
2016/01/06 19:10:55
Is "ChooserContext" the right class name here? IIU
juncai
2016/01/11 21:55:16
Renamed it to class BluetoothPermissionContext.
D
|
| + public: |
| + explicit BluetoothChooserContext(Profile* profile); |
| + ~BluetoothChooserContext() override; |
| + |
| + // Grants |requesting_origin| access to the Bluetooth device known as |
| + // |device_id|. |
|
Jeffrey Yasskin
2016/01/06 19:10:55
We also need to store the set of allowed service U
Jeffrey Yasskin
2016/01/06 19:10:55
"known as |device_id|" doesn't really tell us whic
juncai
2016/01/11 21:55:16
Done.
juncai
2016/01/11 21:55:16
Done.
|
| + void GrantDevicePermission(const GURL& requesting_origin, |
| + const GURL& embedding_origin, |
| + const std::string& device_id); |
| + |
| + // Revokes |requesting_origin|'s access to the Bluetooth device known as |
| + // |device_id|. |
| + void RevokeDevicePermission(const GURL& requesting_origin, |
| + const GURL& embedding_origin, |
| + const std::string& device_id); |
| + |
| + // Checks if |requesting_origin| (when embedded within |embedding_origin| has |
| + // access to the Bluetooth device known as |device_id|. |
| + bool HasDevicePermission(const GURL& requesting_origin, |
|
Jeffrey Yasskin
2016/01/06 19:10:55
This'll probably need to return the set of service
juncai
2016/01/11 21:55:16
Done.
|
| + const GURL& embedding_origin, |
| + const std::string& device_id); |
| + |
| + private: |
| + // ChooserContextBase: |
| + bool IsValidObject(const base::DictionaryValue& object) override; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(BluetoothChooserContext); |
| +}; |
| + |
| +#endif // CHROME_BROWSER_UI_BLUETOOTH_BLUETOOTH_CHOOSER_CONTEXT_H_ |