OLD | NEW |
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_EXTENSION_FILE_UTIL_H_ | 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const std::string& extension_id, | 55 const std::string& extension_id, |
56 extensions::Extension::Location location, | 56 extensions::Extension::Location location, |
57 int flags, | 57 int flags, |
58 std::string* error); | 58 std::string* error); |
59 | 59 |
60 // Loads an extension manifest from the specified directory. Returns NULL | 60 // Loads an extension manifest from the specified directory. Returns NULL |
61 // on failure, with a description of the error in |error|. | 61 // on failure, with a description of the error in |error|. |
62 base::DictionaryValue* LoadManifest(const FilePath& extension_root, | 62 base::DictionaryValue* LoadManifest(const FilePath& extension_root, |
63 std::string* error); | 63 std::string* error); |
64 | 64 |
| 65 // Returns true if the given file path exists and is not zero-length. |
| 66 bool ValidateFilePath(const FilePath& path); |
| 67 |
65 // Returns true if the given extension object is valid and consistent. | 68 // Returns true if the given extension object is valid and consistent. |
66 // May also append a series of warning messages to |warnings|, but they | 69 // May also append a series of warning messages to |warnings|, but they |
67 // should not prevent the extension from running. | 70 // should not prevent the extension from running. |
68 // | 71 // |
69 // Otherwise, returns false, and a description of the error is | 72 // Otherwise, returns false, and a description of the error is |
70 // returned in |error|. | 73 // returned in |error|. |
71 bool ValidateExtension(const extensions::Extension* extension, | 74 bool ValidateExtension(const extensions::Extension* extension, |
72 std::string* error, | 75 std::string* error, |
73 extensions::Extension::InstallWarningVector* warnings); | 76 extensions::Extension::InstallWarningVector* warnings); |
74 | 77 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 FilePath GetUserDataTempDir(); | 126 FilePath GetUserDataTempDir(); |
124 | 127 |
125 // Helper function to delete files. This is used to avoid ugly casts which | 128 // Helper function to delete files. This is used to avoid ugly casts which |
126 // would be necessary with PostMessage since file_util::Delete is overloaded. | 129 // would be necessary with PostMessage since file_util::Delete is overloaded. |
127 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 130 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
128 void DeleteFile(const FilePath& path, bool recursive); | 131 void DeleteFile(const FilePath& path, bool recursive); |
129 | 132 |
130 } // namespace extension_file_util | 133 } // namespace extension_file_util |
131 | 134 |
132 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 135 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
OLD | NEW |