summaryrefslogtreecommitdiffstats
path: root/webkit/fileapi/file_system_util.h
diff options
context:
space:
mode:
authorericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 23:45:42 +0000
committerericu@chromium.org <ericu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-05 23:45:42 +0000
commite41df1e026ff444857c987fcb7066aea68e18769 (patch)
treec2748f255ed355082b4a5a7c899e9921d30da6c0 /webkit/fileapi/file_system_util.h
parentde6ac3294417e61248aa0574365c2782b68f89c9 (diff)
downloadchromium_src-e41df1e026ff444857c987fcb7066aea68e18769.zip
chromium_src-e41df1e026ff444857c987fcb7066aea68e18769.tar.gz
chromium_src-e41df1e026ff444857c987fcb7066aea68e18769.tar.bz2
Fixed bug: we can now handle "a:b" as a file name.
BUG=113569 TEST=LayoutTests/fast/filesystem/op-restricted-chars.html Review URL: http://codereview.chromium.org/9370045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125022 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/fileapi/file_system_util.h')
-rw-r--r--webkit/fileapi/file_system_util.h23
1 files changed, 22 insertions, 1 deletions
diff --git a/webkit/fileapi/file_system_util.h b/webkit/fileapi/file_system_util.h
index fff7794..247d5ce 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