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_MANIFEST_H_ | 5 #ifndef EXTENSIONS_COMMON_MANIFEST_H_ |
6 #define EXTENSIONS_COMMON_MANIFEST_H_ | 6 #define EXTENSIONS_COMMON_MANIFEST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
9 #include <set> | 10 #include <set> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 struct InstallWarning; | 18 struct InstallWarning; |
19 | 19 |
20 // Wraps the DictionaryValue form of extension's manifest. Enforces access to | 20 // Wraps the DictionaryValue form of extension's manifest. Enforces access to |
21 // properties of the manifest using ManifestFeatureProvider. | 21 // properties of the manifest using ManifestFeatureProvider. |
22 class Manifest { | 22 class Manifest { |
23 public: | 23 public: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 static inline bool IsComponentLocation(Location location) { | 109 static inline bool IsComponentLocation(Location location) { |
110 return location == COMPONENT || location == EXTERNAL_COMPONENT; | 110 return location == COMPONENT || location == EXTERNAL_COMPONENT; |
111 } | 111 } |
112 | 112 |
113 // Unpacked extensions start off with file access since they are a developer | 113 // Unpacked extensions start off with file access since they are a developer |
114 // feature. | 114 // feature. |
115 static inline bool ShouldAlwaysAllowFileAccess(Location location) { | 115 static inline bool ShouldAlwaysAllowFileAccess(Location location) { |
116 return IsUnpackedLocation(location); | 116 return IsUnpackedLocation(location); |
117 } | 117 } |
118 | 118 |
119 Manifest(Location location, scoped_ptr<base::DictionaryValue> value); | 119 Manifest(Location location, std::unique_ptr<base::DictionaryValue> value); |
120 virtual ~Manifest(); | 120 virtual ~Manifest(); |
121 | 121 |
122 const std::string& extension_id() const { return extension_id_; } | 122 const std::string& extension_id() const { return extension_id_; } |
123 void set_extension_id(const std::string& id) { extension_id_ = id; } | 123 void set_extension_id(const std::string& id) { extension_id_ = id; } |
124 | 124 |
125 Location location() const { return location_; } | 125 Location location() const { return location_; } |
126 | 126 |
127 // Returns false and |error| will be non-empty if the manifest is malformed. | 127 // Returns false and |error| will be non-empty if the manifest is malformed. |
128 // |warnings| will be populated if there are keys in the manifest that cannot | 128 // |warnings| will be populated if there are keys in the manifest that cannot |
129 // be specified by the extension type. | 129 // be specified by the extension type. |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // A persistent, globally unique ID. An extension's ID is used in things | 184 // A persistent, globally unique ID. An extension's ID is used in things |
185 // like directory structures and URLs, and is expected to not change across | 185 // like directory structures and URLs, and is expected to not change across |
186 // versions. It is generated as a SHA-256 hash of the extension's public | 186 // versions. It is generated as a SHA-256 hash of the extension's public |
187 // key, or as a hash of the path in the case of unpacked extensions. | 187 // key, or as a hash of the path in the case of unpacked extensions. |
188 std::string extension_id_; | 188 std::string extension_id_; |
189 | 189 |
190 // The location the extension was loaded from. | 190 // The location the extension was loaded from. |
191 Location location_; | 191 Location location_; |
192 | 192 |
193 // The underlying dictionary representation of the manifest. | 193 // The underlying dictionary representation of the manifest. |
194 scoped_ptr<base::DictionaryValue> value_; | 194 std::unique_ptr<base::DictionaryValue> value_; |
195 | 195 |
196 Type type_; | 196 Type type_; |
197 | 197 |
198 DISALLOW_COPY_AND_ASSIGN(Manifest); | 198 DISALLOW_COPY_AND_ASSIGN(Manifest); |
199 }; | 199 }; |
200 | 200 |
201 } // namespace extensions | 201 } // namespace extensions |
202 | 202 |
203 #endif // EXTENSIONS_COMMON_MANIFEST_H_ | 203 #endif // EXTENSIONS_COMMON_MANIFEST_H_ |
OLD | NEW |