OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <map> | 10 #include <map> |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Loads and validates an extension from the specified directory. Returns NULL | 38 // Loads and validates an extension from the specified directory. Returns NULL |
39 // on failure, with a description of the error in |error|. | 39 // on failure, with a description of the error in |error|. |
40 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, | 40 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, |
41 Extension::Location location, | 41 Extension::Location location, |
42 int flags, | 42 int flags, |
43 std::string* error); | 43 std::string* error); |
44 | 44 |
45 // Returns true if the given extension object is valid and consistent. | 45 // Returns true if the given extension object is valid and consistent. |
46 // Otherwise, a description of the error is returned in |error|. | 46 // Otherwise, a description of the error is returned in |error|. |
47 bool ValidateExtension(Extension* extension, std::string* error); | 47 bool ValidateExtension(const Extension* extension, std::string* error); |
48 | 48 |
49 // Cleans up the extension install directory. It can end up with garbage in it | 49 // Cleans up the extension install directory. It can end up with garbage in it |
50 // if extensions can't initially be removed when they are uninstalled (eg if a | 50 // if extensions can't initially be removed when they are uninstalled (eg if a |
51 // file is in use). | 51 // file is in use). |
52 // | 52 // |
53 // |extensions_dir| is the install directory to look in. |extension_paths| is a | 53 // |extensions_dir| is the install directory to look in. |extension_paths| is a |
54 // map from extension id to full installation path. | 54 // map from extension id to full installation path. |
55 // | 55 // |
56 // Obsolete version directories are removed, as are directories that aren't | 56 // Obsolete version directories are removed, as are directories that aren't |
57 // found in |extension_paths|. | 57 // found in |extension_paths|. |
(...skipping 25 matching lines...) Expand all Loading... |
83 FilePath GetUserDataTempDir(); | 83 FilePath GetUserDataTempDir(); |
84 | 84 |
85 // Helper function to delete files. This is used to avoid ugly casts which | 85 // Helper function to delete files. This is used to avoid ugly casts which |
86 // would be necessary with PostMessage since file_util::Delete is overloaded. | 86 // would be necessary with PostMessage since file_util::Delete is overloaded. |
87 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 87 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
88 void DeleteFile(const FilePath& path, bool recursive); | 88 void DeleteFile(const FilePath& path, bool recursive); |
89 | 89 |
90 } // namespace extension_file_util | 90 } // namespace extension_file_util |
91 | 91 |
92 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 92 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
OLD | NEW |