| 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 |
| 75 // Loads extension message catalogs and returns message bundle. | 88 // Loads extension message catalogs and returns message bundle. |
| 76 // Returns NULL on error, or if extension is not localized. | 89 // Returns NULL on error, or if extension is not localized. |
| 77 ExtensionMessageBundle* LoadExtensionMessageBundle( | 90 ExtensionMessageBundle* LoadExtensionMessageBundle( |
| 78 const FilePath& extension_path, | 91 const FilePath& extension_path, |
| 79 const std::string& default_locale, | 92 const std::string& default_locale, |
| 80 std::string* error); | 93 std::string* error); |
| 81 | 94 |
| 82 // Loads the extension message bundle substitution map. Contains at least | 95 // Loads the extension message bundle substitution map. Contains at least |
| 83 // extension_id item. | 96 // extension_id item. |
| 84 ExtensionMessageBundle::SubstitutionMap* | 97 ExtensionMessageBundle::SubstitutionMap* |
| (...skipping 23 matching lines...) Expand all Loading... |
| 108 FilePath GetUserDataTempDir(); | 121 FilePath GetUserDataTempDir(); |
| 109 | 122 |
| 110 // Helper function to delete files. This is used to avoid ugly casts which | 123 // Helper function to delete files. This is used to avoid ugly casts which |
| 111 // would be necessary with PostMessage since file_util::Delete is overloaded. | 124 // would be necessary with PostMessage since file_util::Delete is overloaded. |
| 112 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 125 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
| 113 void DeleteFile(const FilePath& path, bool recursive); | 126 void DeleteFile(const FilePath& path, bool recursive); |
| 114 | 127 |
| 115 } // namespace extension_file_util | 128 } // namespace extension_file_util |
| 116 | 129 |
| 117 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 130 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
| OLD | NEW |