| Index: chrome/common/extensions/extension_file_util.cc
|
| diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc
|
| index 3f9a9b99b307956cbec8ac1bc65eda47d7d31f56..848625ee1e229f4ffce20503027bdd5b99b9d371 100644
|
| --- a/chrome/common/extensions/extension_file_util.cc
|
| +++ b/chrome/common/extensions/extension_file_util.cc
|
| @@ -635,6 +635,25 @@ FilePath ExtensionURLToRelativeFilePath(const GURL& url) {
|
| return path;
|
| }
|
|
|
| +FilePath ExtensionResourceURLToFilePath(const GURL& url, const FilePath& root) {
|
| + std::string host = net::UnescapeURLComponent(url.host(),
|
| + net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
|
| + if (host.empty())
|
| + return FilePath();
|
| +
|
| + FilePath relative_path = ExtensionURLToRelativeFilePath(url);
|
| + if (relative_path.empty())
|
| + return FilePath();
|
| +
|
| + FilePath path = root.AppendASCII(host).Append(relative_path);
|
| + if (!file_util::PathExists(path) ||
|
| + !file_util::AbsolutePath(&path) ||
|
| + !root.IsParent(path)) {
|
| + return FilePath();
|
| + }
|
| + return path;
|
| +}
|
| +
|
| FilePath GetUserDataTempDir() {
|
| // We do file IO in this function, but only when the current profile's
|
| // Temp directory has never been used before, or in a rare error case.
|
|
|