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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <map> | 10 #include <map> |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Loads an extension manifest from the specified directory. Returns NULL | 56 // Loads an extension manifest from the specified directory. Returns NULL |
57 // on failure, with a description of the error in |error|. | 57 // on failure, with a description of the error in |error|. |
58 base::DictionaryValue* LoadManifest(const FilePath& extension_root, | 58 base::DictionaryValue* LoadManifest(const FilePath& extension_root, |
59 std::string* error); | 59 std::string* error); |
60 | 60 |
61 // Returns true if the given extension object is valid and consistent. | 61 // Returns true if the given extension object is valid and consistent. |
62 // Otherwise, a description of the error is returned in |error|. | 62 // Otherwise, a description of the error is returned in |error|. |
63 bool ValidateExtension(const Extension* extension, std::string* error); | 63 bool ValidateExtension(const Extension* extension, std::string* error); |
64 | 64 |
65 // Cleans up the extension install directory. It can end up with garbage in it | |
66 // if extensions can't initially be removed when they are uninstalled (eg if a | |
67 // file is in use). | |
68 // | |
69 // |extensions_dir| is the install directory to look in. |extension_paths| is a | |
70 // map from extension id to full installation path. | |
71 // | |
72 // Obsolete version directories are removed, as are directories that aren't | |
73 // found in |extension_paths|. | |
74 void GarbageCollectExtensions( | |
75 const FilePath& extensions_dir, | |
76 const std::map<std::string, FilePath>& extension_paths); | |
77 | |
78 // Loads extension message catalogs and returns message bundle. | 65 // Loads extension message catalogs and returns message bundle. |
79 // Returns NULL on error, or if extension is not localized. | 66 // Returns NULL on error, or if extension is not localized. |
80 ExtensionMessageBundle* LoadExtensionMessageBundle( | 67 ExtensionMessageBundle* LoadExtensionMessageBundle( |
81 const FilePath& extension_path, | 68 const FilePath& extension_path, |
82 const std::string& default_locale, | 69 const std::string& default_locale, |
83 std::string* error); | 70 std::string* error); |
84 | 71 |
85 // Loads the extension message bundle substitution map. Contains at least | 72 // Loads the extension message bundle substitution map. Contains at least |
86 // extension_id item. | 73 // extension_id item. |
87 ExtensionMessageBundle::SubstitutionMap* | 74 ExtensionMessageBundle::SubstitutionMap* |
(...skipping 19 matching lines...) Expand all Loading... |
107 FilePath GetUserDataTempDir(); | 94 FilePath GetUserDataTempDir(); |
108 | 95 |
109 // Helper function to delete files. This is used to avoid ugly casts which | 96 // Helper function to delete files. This is used to avoid ugly casts which |
110 // would be necessary with PostMessage since file_util::Delete is overloaded. | 97 // would be necessary with PostMessage since file_util::Delete is overloaded. |
111 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 98 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
112 void DeleteFile(const FilePath& path, bool recursive); | 99 void DeleteFile(const FilePath& path, bool recursive); |
113 | 100 |
114 } // namespace extension_file_util | 101 } // namespace extension_file_util |
115 | 102 |
116 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 103 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
OLD | NEW |