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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // | 65 // |
66 // Otherwise, returns false, and a description of the error is | 66 // Otherwise, returns false, and a description of the error is |
67 // returned in |error|. | 67 // returned in |error|. |
68 bool ValidateExtension(const extensions::Extension* extension, | 68 bool ValidateExtension(const extensions::Extension* extension, |
69 std::string* error, | 69 std::string* error, |
70 extensions::Extension::InstallWarningVector* warnings); | 70 extensions::Extension::InstallWarningVector* warnings); |
71 | 71 |
72 // Returns a list of files that contain private keys inside |extension_dir|. | 72 // Returns a list of files that contain private keys inside |extension_dir|. |
73 std::vector<FilePath> FindPrivateKeyFiles(const FilePath& extension_dir); | 73 std::vector<FilePath> FindPrivateKeyFiles(const FilePath& extension_dir); |
74 | 74 |
75 // Cleans up the extension install directory. It can end up with garbage in it | |
76 // if extensions can't initially be removed when they are uninstalled (eg if a | |
77 // file is in use). | |
78 // | |
79 // |extensions_dir| is the install directory to look in. |extension_paths| is a | |
80 // map from extension id to full installation path. | |
81 // | |
82 // Obsolete version directories are removed, as are directories that aren't | |
83 // found in |extension_paths|. | |
84 void GarbageCollectExtensions( | |
85 const FilePath& extensions_dir, | |
86 const std::map<std::string, FilePath>& extension_paths); | |
87 | |
88 // Loads extension message catalogs and returns message bundle. | 75 // Loads extension message catalogs and returns message bundle. |
89 // Returns NULL on error, or if extension is not localized. | 76 // Returns NULL on error, or if extension is not localized. |
90 ExtensionMessageBundle* LoadExtensionMessageBundle( | 77 ExtensionMessageBundle* LoadExtensionMessageBundle( |
91 const FilePath& extension_path, | 78 const FilePath& extension_path, |
92 const std::string& default_locale, | 79 const std::string& default_locale, |
93 std::string* error); | 80 std::string* error); |
94 | 81 |
95 // Loads the extension message bundle substitution map. Contains at least | 82 // Loads the extension message bundle substitution map. Contains at least |
96 // extension_id item. | 83 // extension_id item. |
97 ExtensionMessageBundle::SubstitutionMap* | 84 ExtensionMessageBundle::SubstitutionMap* |
(...skipping 23 matching lines...) Expand all Loading... |
121 FilePath GetUserDataTempDir(); | 108 FilePath GetUserDataTempDir(); |
122 | 109 |
123 // Helper function to delete files. This is used to avoid ugly casts which | 110 // Helper function to delete files. This is used to avoid ugly casts which |
124 // would be necessary with PostMessage since file_util::Delete is overloaded. | 111 // would be necessary with PostMessage since file_util::Delete is overloaded. |
125 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 112 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
126 void DeleteFile(const FilePath& path, bool recursive); | 113 void DeleteFile(const FilePath& path, bool recursive); |
127 | 114 |
128 } // namespace extension_file_util | 115 } // namespace extension_file_util |
129 | 116 |
130 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 117 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
OLD | NEW |