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

Side by Side Diff: extensions/common/manifest_handler.h

Issue 2846553003: Extensions: Clarify ManifestHandler interface expectations. (Closed)
Patch Set: Nits. Created 3 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
« no previous file with comments | « no previous file | extensions/common/manifest_handler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_HANDLER_H_ 5 #ifndef EXTENSIONS_COMMON_MANIFEST_HANDLER_H_
6 #define EXTENSIONS_COMMON_MANIFEST_HANDLER_H_ 6 #define EXTENSIONS_COMMON_MANIFEST_HANDLER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 // An interface for clients that recognize and parse keys in extension 22 // An interface for clients that recognize and parse keys in extension
23 // manifests. 23 // manifests.
24 class ManifestHandler { 24 class ManifestHandler {
25 public: 25 public:
26 ManifestHandler(); 26 ManifestHandler();
27 virtual ~ManifestHandler(); 27 virtual ~ManifestHandler();
28 28
29 // Attempts to parse the extension's manifest. 29 // Attempts to parse the extension's manifest.
30 // Returns true on success or false on failure; if false, |error| will 30 // Returns true on success or false on failure; if false, |error| will
31 // be set to a failure message. 31 // be set to a failure message.
32 // This does not perform any IO operations.
lazyboy 2017/04/26 22:53:03 Thinking about it, this doesn't seem that helpful,
karandeepb 2017/04/26 22:57:38 We were doing IO for Validate as in the example I
32 virtual bool Parse(Extension* extension, base::string16* error) = 0; 33 virtual bool Parse(Extension* extension, base::string16* error) = 0;
33 34
34 // Validate that files associated with this manifest key exist. 35 // Validate that files associated with this manifest key exist.
35 // Validation takes place after parsing. May also append a series of 36 // Validation takes place after parsing. May also append a series of
36 // warning messages to |warnings|. 37 // warning messages to |warnings|.
38 // This may perform IO operations.
37 // 39 //
38 // Otherwise, returns false, and a description of the error is 40 // Otherwise, returns false, and a description of the error is
39 // returned in |error|. 41 // returned in |error|.
40 // TODO(yoz): Change error to base::string16. See crbug.com/71980. 42 // TODO(yoz): Change error to base::string16. See crbug.com/71980.
41 virtual bool Validate(const Extension* extension, 43 virtual bool Validate(const Extension* extension,
42 std::string* error, 44 std::string* error,
43 std::vector<InstallWarning>* warnings) const; 45 std::vector<InstallWarning>* warnings) const;
44 46
45 // If false (the default), only parse the manifest if a registered 47 // If false (the default), only parse the manifest if a registered
46 // key is present in the manifest. If true, always attempt to parse 48 // key is present in the manifest. If true, always attempt to parse
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 // Calling FinalizeRegistration indicates that there are no more 84 // Calling FinalizeRegistration indicates that there are no more
83 // manifest handlers to be registered. 85 // manifest handlers to be registered.
84 static void FinalizeRegistration(); 86 static void FinalizeRegistration();
85 87
86 static bool IsRegistrationFinalized(); 88 static bool IsRegistrationFinalized();
87 89
88 // Call Parse on all registered manifest handlers that should parse 90 // Call Parse on all registered manifest handlers that should parse
89 // this extension. 91 // this extension.
90 static bool ParseExtension(Extension* extension, base::string16* error); 92 static bool ParseExtension(Extension* extension, base::string16* error);
91 93
92 // Call Validate on all registered manifest handlers for this extension. 94 // Call Validate on all registered manifest handlers for this extension. This
95 // may perform IO operations.
93 static bool ValidateExtension(const Extension* extension, 96 static bool ValidateExtension(const Extension* extension,
94 std::string* error, 97 std::string* error,
95 std::vector<InstallWarning>* warnings); 98 std::vector<InstallWarning>* warnings);
96 99
97 // Calls |CreatePermission| on the manifest handler for |key|. Returns |NULL| 100 // Calls |CreatePermission| on the manifest handler for |key|. Returns |NULL|
98 // if there is no manifest handler for |key| or if the manifest handler for 101 // if there is no manifest handler for |key| or if the manifest handler for
99 // |key| does not support custom permissions. 102 // |key| does not support custom permissions.
100 static ManifestPermission* CreatePermission(const std::string& key); 103 static ManifestPermission* CreatePermission(const std::string& key);
101 104
102 // Calls |CreateInitialRequiredPermission| on all registered manifest handlers 105 // Calls |CreateInitialRequiredPermission| on all registered manifest handlers
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 // The priority for each manifest handler. Handlers with lower priority 167 // The priority for each manifest handler. Handlers with lower priority
165 // values are evaluated first. 168 // values are evaluated first.
166 ManifestHandlerPriorityMap priority_map_; 169 ManifestHandlerPriorityMap priority_map_;
167 170
168 bool is_finalized_; 171 bool is_finalized_;
169 }; 172 };
170 173
171 } // namespace extensions 174 } // namespace extensions
172 175
173 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLER_H_ 176 #endif // EXTENSIONS_COMMON_MANIFEST_HANDLER_H_
OLDNEW
« no previous file with comments | « no previous file | extensions/common/manifest_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698