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

Side by Side Diff: webkit/fileapi/file_system_util.cc

Issue 9320059: Define FilePath::NormalizePathSeparators on all platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 10 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "webkit/fileapi/file_system_util.h" 5 #include "webkit/fileapi/file_system_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 79
80 // Ensure the path is relative. 80 // Ensure the path is relative.
81 while (!path.empty() && path[0] == '/') 81 while (!path.empty() && path[0] == '/')
82 path.erase(0, 1); 82 path.erase(0, 1);
83 83
84 if (origin_url) 84 if (origin_url)
85 *origin_url = origin; 85 *origin_url = origin;
86 if (type) 86 if (type)
87 *type = file_system_type; 87 *type = file_system_type;
88 if (file_path) 88 if (file_path)
89 #if defined(OS_WIN) 89 *file_path = FilePath::FromUTF8Unsafe(path).
90 *file_path = FilePath(base::SysUTF8ToWide(path)). 90 NormalizePathSeparators().StripTrailingSeparators();
91 NormalizeWindowsPathSeparators().StripTrailingSeparators();
92 #elif defined(OS_POSIX)
93 *file_path = FilePath(path).StripTrailingSeparators();
94 #endif
95 91
96 return true; 92 return true;
97 } 93 }
98 94
99 GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type) { 95 GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type) {
100 std::string path("filesystem:"); 96 std::string path("filesystem:");
101 path += origin_url.spec(); 97 path += origin_url.spec();
102 switch (type) { 98 switch (type) {
103 case kFileSystemTypeTemporary: 99 case kFileSystemTypeTemporary:
104 path += (kTemporaryDir + 1); // We don't want the leading slash. 100 path += (kTemporaryDir + 1); // We don't want the leading slash.
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 return fileapi::kPersistentName; 172 return fileapi::kPersistentName;
177 case kFileSystemTypeExternal: 173 case kFileSystemTypeExternal:
178 return fileapi::kExternalName; 174 return fileapi::kExternalName;
179 case kFileSystemTypeUnknown: 175 case kFileSystemTypeUnknown:
180 default: 176 default:
181 return std::string(); 177 return std::string();
182 } 178 }
183 } 179 }
184 180
185 } // namespace fileapi 181 } // namespace fileapi
OLDNEW
« no previous file with comments | « content/browser/download/download_manager_impl_unittest.cc ('k') | webkit/fileapi/isolated_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698