| 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 10 matching lines...) Expand all Loading... |
| 21 } | 21 } |
| 22 | 22 |
| 23 // Utilties for manipulating the on-disk storage of extensions. | 23 // Utilties for manipulating the on-disk storage of extensions. |
| 24 namespace extension_file_util { | 24 namespace extension_file_util { |
| 25 | 25 |
| 26 // The name of the directory inside the profile that we store installed | 26 // The name of the directory inside the profile that we store installed |
| 27 // extension in. | 27 // extension in. |
| 28 extern const char kInstallDirectoryName[]; | 28 extern const char kInstallDirectoryName[]; |
| 29 | 29 |
| 30 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. | 30 // Copies |unpacked_source_dir| into the right location under |extensions_dir|. |
| 31 // Deletes the source directory if |should_delete_source| is true. |
| 31 // The destination directiory is returned on success, or empty path is returned | 32 // The destination directiory is returned on success, or empty path is returned |
| 32 // on failure. | 33 // on failure. |
| 33 FilePath InstallExtension(const FilePath& unpacked_source_dir, | 34 FilePath InstallExtension(const FilePath& unpacked_source_dir, |
| 34 const std::string& id, | 35 const std::string& id, |
| 35 const std::string& version, | 36 const std::string& version, |
| 36 const FilePath& extensions_dir); | 37 const FilePath& extensions_dir, |
| 38 bool should_delete_source); |
| 37 | 39 |
| 38 // Removes all versions of the extension with |id| from |extensions_dir|. | 40 // Removes all versions of the extension with |id| from |extensions_dir|. |
| 39 void UninstallExtension(const FilePath& extensions_dir, | 41 void UninstallExtension(const FilePath& extensions_dir, |
| 40 const std::string& id); | 42 const std::string& id); |
| 41 | 43 |
| 42 // Loads and validates an extension from the specified directory. Returns NULL | 44 // Loads and validates an extension from the specified directory. Returns NULL |
| 43 // on failure, with a description of the error in |error|. | 45 // on failure, with a description of the error in |error|. |
| 44 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, | 46 scoped_refptr<Extension> LoadExtension(const FilePath& extension_root, |
| 45 Extension::Location location, | 47 Extension::Location location, |
| 46 int flags, | 48 int flags, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 FilePath GetUserDataTempDir(); | 102 FilePath GetUserDataTempDir(); |
| 101 | 103 |
| 102 // Helper function to delete files. This is used to avoid ugly casts which | 104 // Helper function to delete files. This is used to avoid ugly casts which |
| 103 // would be necessary with PostMessage since file_util::Delete is overloaded. | 105 // would be necessary with PostMessage since file_util::Delete is overloaded. |
| 104 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. | 106 // TODO(skerner): Make a version of Delete that is not overloaded in file_util. |
| 105 void DeleteFile(const FilePath& path, bool recursive); | 107 void DeleteFile(const FilePath& path, bool recursive); |
| 106 | 108 |
| 107 } // namespace extension_file_util | 109 } // namespace extension_file_util |
| 108 | 110 |
| 109 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 111 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
| OLD | NEW |