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

Side by Side Diff: chrome/common/extensions/manifest.h

Issue 9705083: Unknown options in extension manifest file are silently ignored (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Changes per comments Created 8 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_COMMON_EXTENSIONS_MANIFEST_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_MANIFEST_H_
6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_H_ 6 #define CHROME_COMMON_EXTENSIONS_MANIFEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 15 matching lines...) Expand all
26 virtual ~Manifest(); 26 virtual ~Manifest();
27 27
28 const std::string& extension_id() const { return extension_id_; } 28 const std::string& extension_id() const { return extension_id_; }
29 void set_extension_id(const std::string& id) { extension_id_ = id; } 29 void set_extension_id(const std::string& id) { extension_id_ = id; }
30 30
31 Extension::Location location() const { return location_; } 31 Extension::Location location() const { return location_; }
32 void set_location(Extension::Location location) { location_ = location; } 32 void set_location(Extension::Location location) { location_ = location; }
33 33
34 // Returns true if all keys in the manifest can be specified by 34 // Returns true if all keys in the manifest can be specified by
35 // the extension type. 35 // the extension type.
36 bool ValidateManifest(string16* error) const; 36 bool ValidateManifest(string16* error);
37 37
38 // The version of this extension's manifest. We increase the manifest 38 // The version of this extension's manifest. We increase the manifest
39 // version when making breaking changes to the extension system. If the 39 // version when making breaking changes to the extension system. If the
40 // manifest contains no explicit manifest version, this returns the current 40 // manifest contains no explicit manifest version, this returns the current
41 // system default. 41 // system default.
42 int GetManifestVersion() const; 42 int GetManifestVersion() const;
43 43
44 // Returns the manifest type. 44 // Returns the manifest type.
45 Extension::Type GetType() const; 45 Extension::Type GetType() const;
46 46
(...skipping 25 matching lines...) Expand all
72 // the caller. 72 // the caller.
73 Manifest* DeepCopy() const; 73 Manifest* DeepCopy() const;
74 74
75 // Returns true if this equals the |other| manifest. 75 // Returns true if this equals the |other| manifest.
76 bool Equals(const Manifest* other) const; 76 bool Equals(const Manifest* other) const;
77 77
78 // Gets the underlying DictionaryValue representing the manifest. 78 // Gets the underlying DictionaryValue representing the manifest.
79 // Note: only know this when you KNOW you don't need the validation. 79 // Note: only know this when you KNOW you don't need the validation.
80 base::DictionaryValue* value() const { return value_.get(); } 80 base::DictionaryValue* value() const { return value_.get(); }
81 81
82 // Gets the list of unrecognized keys in the manifest, if any.
83 // Unrecognized keys are filled in when ValidateManifest is called.
84 std::vector<std::string> GetUnrecognizedKeys() const {
not at google - send to devlin 2012/04/30 02:32:36 Just call this unrecognized_keys(); this is the st
85 return unrecognized_keys_;
86 }
87
82 private: 88 private:
83 // Returns true if the extension can specify the given |path|. 89 // Returns true if the extension can specify the given |path|.
84 bool CanAccessPath(const std::string& path) const; 90 bool CanAccessPath(const std::string& path) const;
85 bool CanAccessKey(const std::string& key) const; 91 bool CanAccessKey(const std::string& key) const;
86 92
87 // A persistent, globally unique ID. An extension's ID is used in things 93 // A persistent, globally unique ID. An extension's ID is used in things
88 // like directory structures and URLs, and is expected to not change across 94 // like directory structures and URLs, and is expected to not change across
89 // versions. It is generated as a SHA-256 hash of the extension's public 95 // versions. It is generated as a SHA-256 hash of the extension's public
90 // key, or as a hash of the path in the case of unpacked extensions. 96 // key, or as a hash of the path in the case of unpacked extensions.
91 std::string extension_id_; 97 std::string extension_id_;
92 98
93 // The location the extension was loaded from. 99 // The location the extension was loaded from.
94 Extension::Location location_; 100 Extension::Location location_;
95 101
96 // The underlying dictionary representation of the manifest. 102 // The underlying dictionary representation of the manifest.
97 scoped_ptr<base::DictionaryValue> value_; 103 scoped_ptr<base::DictionaryValue> value_;
98 104
105 // Unrecognized keys (e.g. "permisions": ["tabs"])
106 std::vector<std::string> unrecognized_keys_;
107
99 DISALLOW_COPY_AND_ASSIGN(Manifest); 108 DISALLOW_COPY_AND_ASSIGN(Manifest);
100 }; 109 };
101 110
102 } // namespace extensions 111 } // namespace extensions
103 112
104 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_H_ 113 #endif // CHROME_COMMON_EXTENSIONS_MANIFEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698