OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_COMMON_FILE_UTIL_H_ | 5 #ifndef EXTENSIONS_COMMON_FILE_UTIL_H_ |
6 #define EXTENSIONS_COMMON_FILE_UTIL_H_ | 6 #define EXTENSIONS_COMMON_FILE_UTIL_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir); | 108 base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir); |
109 | 109 |
110 // 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 |
111 // would be necessary with PostMessage since base::Delete is overloaded. | 111 // would be necessary with PostMessage since base::Delete is overloaded. |
112 // 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. |
113 void DeleteFile(const base::FilePath& path, bool recursive); | 113 void DeleteFile(const base::FilePath& path, bool recursive); |
114 | 114 |
115 // Get a relative file path from a chrome-extension:// URL. | 115 // Get a relative file path from a chrome-extension:// URL. |
116 base::FilePath ExtensionURLToRelativeFilePath(const GURL& url); | 116 base::FilePath ExtensionURLToRelativeFilePath(const GURL& url); |
117 | 117 |
118 // Get a full file path from a chrome-extension-resource:// URL, If the URL | |
119 // points a file outside of root, this function will return empty FilePath. | |
120 base::FilePath ExtensionResourceURLToFilePath(const GURL& url, | |
121 const base::FilePath& root); | |
122 | |
123 // Returns true if the icons in the icon set exist. Oherwise, populates | 118 // Returns true if the icons in the icon set exist. Oherwise, populates |
124 // |error| with the |error_message_id| for an invalid file. | 119 // |error| with the |error_message_id| for an invalid file. |
125 bool ValidateExtensionIconSet(const ExtensionIconSet& icon_set, | 120 bool ValidateExtensionIconSet(const ExtensionIconSet& icon_set, |
126 const Extension* extension, | 121 const Extension* extension, |
127 int error_message_id, | 122 int error_message_id, |
128 std::string* error); | 123 std::string* error); |
129 | 124 |
130 // Loads extension message catalogs and returns message bundle. | 125 // Loads extension message catalogs and returns message bundle. |
131 // Returns NULL on error or if the extension is not localized. | 126 // Returns NULL on error or if the extension is not localized. |
132 MessageBundle* LoadMessageBundle(const base::FilePath& extension_path, | 127 MessageBundle* LoadMessageBundle(const base::FilePath& extension_path, |
(...skipping 15 matching lines...) Expand all Loading... |
148 const ExtensionSet& extension_set); | 143 const ExtensionSet& extension_set); |
149 | 144 |
150 // Helper functions for getting paths for files used in content verification. | 145 // Helper functions for getting paths for files used in content verification. |
151 base::FilePath GetVerifiedContentsPath(const base::FilePath& extension_path); | 146 base::FilePath GetVerifiedContentsPath(const base::FilePath& extension_path); |
152 base::FilePath GetComputedHashesPath(const base::FilePath& extension_path); | 147 base::FilePath GetComputedHashesPath(const base::FilePath& extension_path); |
153 | 148 |
154 } // namespace file_util | 149 } // namespace file_util |
155 } // namespace extensions | 150 } // namespace extensions |
156 | 151 |
157 #endif // EXTENSIONS_COMMON_FILE_UTIL_H_ | 152 #endif // EXTENSIONS_COMMON_FILE_UTIL_H_ |
OLD | NEW |