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

Side by Side Diff: chrome/common/extensions/api/bluetooth/bluetooth_manifest_permission.h

Issue 420663003: Extensions: Move bluetooth APIs to extensions/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix android, gn Created 6 years, 3 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #ifndef CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_
6 #define CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_H_
7
8 #include <set>
9 #include <vector>
10
11 #include "extensions/common/install_warning.h"
12 #include "extensions/common/permissions/manifest_permission.h"
13
14 namespace extensions {
15 class Extension;
16 }
17
18 namespace extensions {
19 struct BluetoothPermissionRequest;
20 }
21
22 namespace extensions {
23
24 class BluetoothManifestPermission : public ManifestPermission {
25 public:
26 typedef std::set<std::string> BluetoothUuidSet;
27 BluetoothManifestPermission();
28 virtual ~BluetoothManifestPermission();
29
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);
35
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;
40
41 void AddPermission(const std::string& uuid);
42
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)
51 const OVERRIDE;
52 virtual ManifestPermission* Union(const ManifestPermission* rhs)
53 const OVERRIDE;
54 virtual ManifestPermission* Intersect(const ManifestPermission* rhs)
55 const OVERRIDE;
56
57 const BluetoothUuidSet& uuids() const {
58 return uuids_;
59 }
60
61 private:
62 BluetoothUuidSet uuids_;
63 bool socket_;
64 bool low_energy_;
65 };
66
67 } // namespace extensions
68
69 #endif // CHROME_COMMON_EXTENSIONS_API_BLUETOOTH_BLUETOOTH_MANIFEST_PERMISSION_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698