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

Side by Side Diff: extensions/common/permissions/manifest_permission.h

Issue 51433002: Enable permission warnings from ManifestHandlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code review comments. Created 7 years, 1 month 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 2013 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 EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_
6 #define EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "base/pickle.h"
12 #include "extensions/common/permissions/permission_message.h"
13
14 class PickleIterator;
15
16 namespace base {
17 class Value;
18 class ListValue;
19 }
20
21 namespace IPC {
22 class Message;
23 }
24
25 namespace extensions {
26
27 // Represent the custom behavior of a top-level manifest entry contributing to
28 // permission messages and storage.
29 class ManifestPermission {
30 public:
31 ManifestPermission();
32 virtual ~ManifestPermission();
33
34 // The manifest key this permission applies to.
35 virtual std::string name() const = 0;
36
37 // Same as name(), needed for compatibility with APIPermission.
38 virtual std::string id() const = 0;
39
40 // Returns true if this permission has any PermissionMessages.
41 virtual bool HasMessages() const = 0;
42
43 // Returns the localized permission messages of this permission.
44 virtual PermissionMessages GetMessages() const = 0;
45
46 // Parses the ManifestPermission from |value|. Returns false if error happens.
47 virtual bool FromValue(const base::Value* value) = 0;
48
49 // Stores this into a new created |value|.
50 virtual scoped_ptr<base::Value> ToValue() const = 0;
51
52 // Clones this.
53 virtual ManifestPermission* Clone() const = 0;
54
55 // Returns a new manifest permission which equals this - |rhs|.
56 virtual ManifestPermission* Diff(const ManifestPermission* rhs) const = 0;
57
58 // Returns a new manifest permission which equals the union of this and |rhs|.
59 virtual ManifestPermission* Union(const ManifestPermission* rhs) const = 0;
60
61 // Returns a new manifest permission which equals the intersect of this and
62 // |rhs|.
63 virtual ManifestPermission* Intersect(const ManifestPermission* rhs)
64 const = 0;
65
66 // Returns true if |rhs| is a subset of this.
67 virtual bool Contains(const ManifestPermission* rhs) const = 0;
68
69 // Returns true if |rhs| is equal to this.
70 virtual bool Equal(const ManifestPermission* rhs) const = 0;
71
72 // IPC functions
73 // Writes this into the given IPC message |m|.
74 virtual void Write(IPC::Message* m) const = 0;
75
76 // Reads from the given IPC message |m|.
77 virtual bool Read(const IPC::Message* m, PickleIterator* iter) = 0;
78
79 // Logs this permission.
80 virtual void Log(std::string* log) const = 0;
81
82 private:
83 DISALLOW_COPY_AND_ASSIGN(ManifestPermission);
84 };
85
86 } // namespace extensions
87
88 #endif // EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698