Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5812)

Unified Diff: chrome/common/extensions/extension_file_util.cc

Issue 65123002: Move chrome/common/extensions/background_info.h to src/extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase2 background_info Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 7c2a94ed1275e0150de06b4f060d460a5d5d6c9e..fd882cf9d2c014f4100ddb19f63036fe045c855c 100644
--- a/chrome/common/extensions/extension_file_util.cc
+++ b/chrome/common/extensions/extension_file_util.cc
@@ -34,7 +34,6 @@
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_handler.h"
#include "grit/generated_resources.h"
-#include "net/base/escape.h"
#include "net/base/file_stream.h"
#include "ui/base/l10n/l10n_util.h"
@@ -493,49 +492,6 @@ bool CheckForIllegalFilenames(const base::FilePath& extension_path,
return true;
}
-base::FilePath ExtensionURLToRelativeFilePath(const GURL& url) {
- std::string url_path = url.path();
- if (url_path.empty() || url_path[0] != '/')
- return base::FilePath();
-
- // Drop the leading slashes and convert %-encoded UTF8 to regular UTF8.
- std::string file_path = net::UnescapeURLComponent(url_path,
- net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
- size_t skip = file_path.find_first_not_of("/\\");
- if (skip != file_path.npos)
- file_path = file_path.substr(skip);
-
- base::FilePath path = base::FilePath::FromUTF8Unsafe(file_path);
-
- // It's still possible for someone to construct an annoying URL whose path
- // would still wind up not being considered relative at this point.
- // For example: chrome-extension://id/c:////foo.html
- if (path.IsAbsolute())
- return base::FilePath();
-
- return path;
-}
-
-base::FilePath ExtensionResourceURLToFilePath(const GURL& url,
- const base::FilePath& root) {
- std::string host = net::UnescapeURLComponent(url.host(),
- net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS);
- if (host.empty())
- return base::FilePath();
-
- base::FilePath relative_path = ExtensionURLToRelativeFilePath(url);
- if (relative_path.empty())
- return base::FilePath();
-
- base::FilePath path = root.AppendASCII(host).Append(relative_path);
- if (!base::PathExists(path))
- return base::FilePath();
- path = base::MakeAbsoluteFilePath(path);
- if (path.empty() || !root.IsParent(path))
- return base::FilePath();
- return path;
-}
-
base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir) {
// 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.
« no previous file with comments | « chrome/common/extensions/extension_file_util.h ('k') | chrome/common/extensions/extension_file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698