1 // Copyright 2014 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.
5 #ifndef EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_
6 #define EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_
11 #include "extensions/common/install_warning.h"
12 #include "extensions/common/permissions/manifest_permission.h"
14 namespace extensions {
18 namespace extensions {
19 struct BluetoothPermissionRequest;
22 namespace extensions {
24 class BluetoothManifestPermission : public ManifestPermission {
26 typedef std::set<std::string> BluetoothUuidSet;
27 BluetoothManifestPermission();
28 virtual ~BluetoothManifestPermission();
30 // Tries to construct the info based on |value|, as it would have appeared in
31 // the manifest. Sets |error| and returns an empty scoped_ptr on failure.
32 static scoped_ptr<BluetoothManifestPermission> FromValue(
33 const base::Value& value,
34 base::string16* error);
36 bool CheckRequest(const Extension* extension,
37 const BluetoothPermissionRequest& request) const;
38 bool CheckSocketPermitted(const Extension* extension) const;
39 bool CheckLowEnergyPermitted(const Extension* extension) const;
41 void AddPermission(const std::string& uuid);
43 // extensions::ManifestPermission overrides.
44 virtual std::string name() const OVERRIDE;
45 virtual std::string id() const OVERRIDE;
46 virtual bool HasMessages() const OVERRIDE;
47 virtual PermissionMessages GetMessages() const OVERRIDE;
48 virtual bool FromValue(const base::Value* value) OVERRIDE;
49 virtual scoped_ptr<base::Value> ToValue() const OVERRIDE;
50 virtual ManifestPermission* Diff(const ManifestPermission* rhs)
52 virtual ManifestPermission* Union(const ManifestPermission* rhs)
54 virtual ManifestPermission* Intersect(const ManifestPermission* rhs)
57 const BluetoothUuidSet& uuids() const {
62 BluetoothUuidSet uuids_;
67 } // namespace extensions
69 #endif // EXTENSIONS_COMMON_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_