diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 02:04:40 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 02:04:40 +0000 |
commit | d9034ed2e96d3910c1f4d4d0f9ad3c7ce048679a (patch) | |
tree | cb4454406c639bc0aa5c5a520e5967619ac50109 /chrome/browser/extensions/extension_protocols.cc | |
parent | 554efaa8b3220e675ad3743eca7f699ad52e2c82 (diff) | |
download | chromium_src-d9034ed2e96d3910c1f4d4d0f9ad3c7ce048679a.zip chromium_src-d9034ed2e96d3910c1f4d4d0f9ad3c7ce048679a.tar.gz chromium_src-d9034ed2e96d3910c1f4d4d0f9ad3c7ce048679a.tar.bz2 |
Define FilePath::NormalizePathSeparators on all platforms
I assume the method FilePath::NormalizeWindowsPathSeparators() is intentionally defined only on Windows, but recently I found myself trying to add a static method (named NormalizePathSeparators()) which calls NormalizeWindowsPathSeparators() or does nothing with platform ifdefs, and then found that there's another place defining the same static method.
Maybe we could just add the common method in FilePath then? It'd at least make the code cleaner at several callsites. I don't think this has visible negative performance impact with optimization build.
BUG=none
TEST=FilePathTest.NormalizePathSeparators and all other existing tests
Review URL: https://chromiumcodereview.appspot.com/9320059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121380 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_protocols.cc')
-rw-r--r-- | chrome/browser/extensions/extension_protocols.cc | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index fd0537e..e2dc94f 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -286,9 +286,7 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const { directory_path.DirName() == resources_path) { FilePath relative_path = directory_path.BaseName().Append( extension_file_util::ExtensionURLToRelativeFilePath(request->url())); -#if defined(OS_WIN) - relative_path = relative_path.NormalizeWindowsPathSeparators(); -#endif + relative_path = relative_path.NormalizePathSeparators(); // TODO(tc): Make a map of FilePath -> resource ids so we don't have to // covert to FilePaths all the time. This will be more useful as we add @@ -296,9 +294,7 @@ ExtensionProtocolHandler::MaybeCreateJob(net::URLRequest* request) const { for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) { FilePath bm_resource_path = FilePath().AppendASCII(kComponentExtensionResources[i].name); -#if defined(OS_WIN) - bm_resource_path = bm_resource_path.NormalizeWindowsPathSeparators(); -#endif + bm_resource_path = bm_resource_path.NormalizePathSeparators(); if (relative_path == bm_resource_path) { return new URLRequestResourceBundleJob(request, relative_path, kComponentExtensionResources[i].value, content_security_policy, |