OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // | 59 // |
60 // NOTE: |src_dir| is not actually copied in the case of downgrades or | 60 // NOTE: |src_dir| is not actually copied in the case of downgrades or |
61 // overinstall of previous verisons of the extension. In that case, the function | 61 // overinstall of previous verisons of the extension. In that case, the function |
62 // returns true and install_type is populated. | 62 // returns true and install_type is populated. |
63 bool InstallExtension(const FilePath& src_dir, | 63 bool InstallExtension(const FilePath& src_dir, |
64 const FilePath& version_dir, | 64 const FilePath& version_dir, |
65 std::string* error); | 65 std::string* error); |
66 | 66 |
67 // Loads and validates an extension from the specified directory. Returns NULL | 67 // Loads and validates an extension from the specified directory. Returns NULL |
68 // on failure, with a description of the error in |error|. | 68 // on failure, with a description of the error in |error|. |
69 Extension* LoadExtension(const FilePath& extension_root, bool require_key, | 69 Extension* LoadExtension(const FilePath& extension_root, |
| 70 bool require_key, |
70 std::string* error); | 71 std::string* error); |
71 | 72 |
72 // Returns true if the given extension object is valid and consistent. | 73 // Returns true if the given extension object is valid and consistent. |
73 // Otherwise, a description of the error is returned in |error|. | 74 // Otherwise, a description of the error is returned in |error|. |
74 bool ValidateExtension(Extension* extension, std::string* error); | 75 bool ValidateExtension(Extension* extension, std::string* error); |
75 | 76 |
76 // Uninstalls the extension |id| from the install directory |extensions_dir|. | 77 // Uninstalls the extension |id| from the install directory |extensions_dir|. |
77 void UninstallExtension(const std::string& id, const FilePath& extensions_dir); | 78 void UninstallExtension(const std::string& id, const FilePath& extensions_dir); |
78 | 79 |
79 // Clean up directories that aren't valid extensions from the install directory. | 80 // Clean up directories that aren't valid extensions from the install directory. |
80 // TODO(aa): Also consider passing in a list of known current extensions and | 81 // TODO(aa): Also consider passing in a list of known current extensions and |
81 // removing others? | 82 // removing others? |
82 void GarbageCollectExtensions(const FilePath& extensions_dir, | 83 void GarbageCollectExtensions(const FilePath& extensions_dir, |
83 const std::set<std::string>& installed_ids); | 84 const std::set<std::string>& installed_ids); |
84 | 85 |
85 // We need to reserve the namespace of entries that start with "_" for future | 86 // We need to reserve the namespace of entries that start with "_" for future |
86 // use by Chrome. | 87 // use by Chrome. |
87 // If any files or directories are found using "_" prefix and are not on | 88 // If any files or directories are found using "_" prefix and are not on |
88 // reserved list we return false, and set error message. | 89 // reserved list we return false, and set error message. |
89 bool CheckForIllegalFilenames(const FilePath& extension_path, | 90 bool CheckForIllegalFilenames(const FilePath& extension_path, |
90 std::string* error); | 91 std::string* error); |
91 | 92 |
92 } // extension_file_util | 93 } // extension_file_util |
93 | 94 |
94 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ | 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_UTIL_H_ |
OLD | NEW |