Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ | 5 #ifndef EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ |
| 6 #define EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ | 6 #define EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 | 42 |
| 43 // Returns the localized permission messages of this permission. | 43 // Returns the localized permission messages of this permission. |
| 44 virtual PermissionMessages GetMessages() const = 0; | 44 virtual PermissionMessages GetMessages() const = 0; |
| 45 | 45 |
| 46 // Parses the ManifestPermission from |value|. Returns false if error happens. | 46 // Parses the ManifestPermission from |value|. Returns false if error happens. |
| 47 virtual bool FromValue(const base::Value* value) = 0; | 47 virtual bool FromValue(const base::Value* value) = 0; |
| 48 | 48 |
| 49 // Stores this into a new created Value. | 49 // Stores this into a new created Value. |
| 50 virtual scoped_ptr<base::Value> ToValue() const = 0; | 50 virtual scoped_ptr<base::Value> ToValue() const = 0; |
| 51 | 51 |
| 52 // Clones this. | 52 // Clones this. |
|
not at google - send to devlin
2014/07/18 17:41:18
you should add comments for all of these functions
aboxhall
2014/07/18 21:08:52
Done (made them non-virtual).
| |
| 53 virtual ManifestPermission* Clone() const = 0; | 53 virtual ManifestPermission* Clone() const; |
| 54 | 54 |
| 55 // Returns a new manifest permission which equals this - |rhs|. | 55 // Returns a new manifest permission which equals this - |rhs|. |
| 56 virtual ManifestPermission* Diff(const ManifestPermission* rhs) const = 0; | 56 virtual ManifestPermission* Diff(const ManifestPermission* rhs) const = 0; |
| 57 | 57 |
| 58 // Returns a new manifest permission which equals the union of this and |rhs|. | 58 // Returns a new manifest permission which equals the union of this and |rhs|. |
| 59 virtual ManifestPermission* Union(const ManifestPermission* rhs) const = 0; | 59 virtual ManifestPermission* Union(const ManifestPermission* rhs) const = 0; |
| 60 | 60 |
| 61 // Returns a new manifest permission which equals the intersect of this and | 61 // Returns a new manifest permission which equals the intersect of this and |
| 62 // |rhs|. | 62 // |rhs|. |
| 63 virtual ManifestPermission* Intersect(const ManifestPermission* rhs) | 63 virtual ManifestPermission* Intersect(const ManifestPermission* rhs) |
|
not at google - send to devlin
2014/07/18 17:41:17
you should be able to implement Intersect as Union
aboxhall
2014/07/18 21:08:52
Not done. Too weird/magical - I can see the logic,
| |
| 64 const = 0; | 64 const = 0; |
| 65 | 65 |
| 66 // Returns true if |rhs| is a subset of this. | 66 // Returns true if |rhs| is a subset of this. |
| 67 virtual bool Contains(const ManifestPermission* rhs) const = 0; | 67 virtual bool Contains(const ManifestPermission* rhs) const; |
| 68 | 68 |
| 69 // Returns true if |rhs| is equal to this. | 69 // Returns true if |rhs| is equal to this. |
| 70 virtual bool Equal(const ManifestPermission* rhs) const = 0; | 70 virtual bool Equal(const ManifestPermission* rhs) const = 0; |
|
not at google - send to devlin
2014/07/18 17:41:17
you should be able to implement Equal as well?
aboxhall
2014/07/18 21:08:52
Done.
| |
| 71 | 71 |
| 72 // IPC functions | 72 // IPC functions |
| 73 // Writes this into the given IPC message |m|. | 73 // Writes this into the given IPC message |m|. |
| 74 virtual void Write(IPC::Message* m) const = 0; | 74 virtual void Write(IPC::Message* m) const; |
| 75 | 75 |
| 76 // Reads from the given IPC message |m|. | 76 // Reads from the given IPC message |m|. |
| 77 virtual bool Read(const IPC::Message* m, PickleIterator* iter) = 0; | 77 virtual bool Read(const IPC::Message* m, PickleIterator* iter); |
| 78 | 78 |
| 79 // Logs this permission. | 79 // Logs this permission. |
| 80 virtual void Log(std::string* log) const = 0; | 80 virtual void Log(std::string* log) const; |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 DISALLOW_COPY_AND_ASSIGN(ManifestPermission); | 83 DISALLOW_COPY_AND_ASSIGN(ManifestPermission); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 } // namespace extensions | 86 } // namespace extensions |
| 87 | 87 |
| 88 #endif // EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ | 88 #endif // EXTENSIONS_COMMON_PERMISSIONS_MANIFEST_PERMISSION_H_ |
| OLD | NEW |