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

Unified Diff: webkit/fileapi/file_system_util.h

Issue 9370045: Fixed bug: we can now handle "a:b" as a file name. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/fileapi/file_system_quota_unittest.cc ('k') | webkit/fileapi/file_system_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_util.h
diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h
index fff7794cb961243ba33c3471c6c0838d4889eb5e..247d5ce30c24127ddcafe8d548725f0ad1b13cf2 100644
--- a/webkit/fileapi/file_system_util.h
+++ b/webkit/fileapi/file_system_util.h
@@ -6,10 +6,10 @@
#define WEBKIT_FILEAPI_FILE_SYSTEM_UTIL_H_
#pragma once
+#include "base/file_path.h"
#include "webkit/fileapi/file_system_types.h"
#include "webkit/quota/quota_types.h"
-class FilePath;
class GURL;
namespace fileapi {
@@ -26,11 +26,32 @@ extern const char kExternalName[];
// url and the routine could successfully crack it, returns false otherwise.
// The file_path this returns will be using '/' as a path separator, no matter
// what platform you're on.
+// TODO(ericu): Look into making file_path [and all FileSystem API virtual
+// paths] just an std::string, to prevent platform-specific FilePath behavior
+// from getting invoked by accident. Currently the FilePath returned here needs
+// special treatment, as it may contain paths that are illegal on the current
+// platform. To avoid problems, use VirtualPath::BaseName and
+// VirtualPath::GetComponents instead of the FilePath methods.
bool CrackFileSystemURL(const GURL& url,
GURL* origin_url,
FileSystemType* type,
FilePath* file_path);
+class VirtualPath {
+ public:
+ // Use this instead of FilePath::BaseName when operating on virtual paths.
+ // FilePath::BaseName will get confused by ':' on Windows when it looks like a
+ // drive letter separator; this will treat it as just another character.
+ static FilePath BaseName(const FilePath& virtual_path);
+
+ // Likewise, use this instead of FilePath::GetComponents when operating on
+ // virtual paths.
+ // Note that this assumes very clean input, with no leading slash, and it will
+ // not evaluate '.' or '..' components.
+ static void GetComponents(const FilePath& path,
+ std::vector<FilePath::StringType>* components);
+};
+
// Returns the root URI of the filesystem that can be specified by a pair of
// |origin_url| and |type|. The returned URI can be used as a root path
// of the filesystem (e.g. <returned_URI> + "/relative/path" will compose
« no previous file with comments | « webkit/fileapi/file_system_quota_unittest.cc ('k') | webkit/fileapi/file_system_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698