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

Unified Diff: webkit/fileapi/isolated_context.cc

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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/isolated_context.h ('k') | webkit/fileapi/isolated_context_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/isolated_context.cc
diff --git a/webkit/fileapi/isolated_context.cc b/webkit/fileapi/isolated_context.cc
index fe1aec0ce3000ff97c1cb103bd9726b8d7dfbf3c..12232ce77cb8c6cf091ab72a74219a982a1def10 100644
--- a/webkit/fileapi/isolated_context.cc
+++ b/webkit/fileapi/isolated_context.cc
@@ -18,15 +18,15 @@ namespace fileapi {
namespace {
-FilePath::StringType GetRegisterNameForPath(const FilePath& path) {
+base::FilePath::StringType GetRegisterNameForPath(const base::FilePath& path) {
// If it's not a root path simply return a base name.
if (path.DirName() != path)
return path.BaseName().value();
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
- FilePath::StringType name;
+ base::FilePath::StringType name;
for (size_t i = 0;
- i < path.value().size() && !FilePath::IsSeparator(path.value()[i]);
+ i < path.value().size() && !base::FilePath::IsSeparator(path.value()[i]);
++i) {
if (path.value()[i] == L':') {
name.append(L"_drive");
@@ -67,19 +67,19 @@ IsolatedContext::FileInfoSet::FileInfoSet() {}
IsolatedContext::FileInfoSet::~FileInfoSet() {}
bool IsolatedContext::FileInfoSet::AddPath(
- const FilePath& path, std::string* registered_name) {
+ const base::FilePath& path, std::string* registered_name) {
// The given path should not contain any '..' and should be absolute.
if (path.ReferencesParent() || !path.IsAbsolute())
return false;
- FilePath::StringType name = GetRegisterNameForPath(path);
- std::string utf8name = FilePath(name).AsUTF8Unsafe();
- FilePath normalized_path = path.NormalizePathSeparators();
+ base::FilePath::StringType name = GetRegisterNameForPath(path);
+ std::string utf8name = base::FilePath(name).AsUTF8Unsafe();
+ base::FilePath normalized_path = path.NormalizePathSeparators();
bool inserted =
fileset_.insert(MountPointInfo(utf8name, normalized_path)).second;
if (!inserted) {
int suffix = 1;
- std::string basepart = FilePath(name).RemoveExtension().AsUTF8Unsafe();
- std::string ext = FilePath(FilePath(name).Extension()).AsUTF8Unsafe();
+ std::string basepart = base::FilePath(name).RemoveExtension().AsUTF8Unsafe();
+ std::string ext = base::FilePath(base::FilePath(name).Extension()).AsUTF8Unsafe();
while (!inserted) {
utf8name = base::StringPrintf("%s (%d)", basepart.c_str(), suffix++);
if (!ext.empty())
@@ -94,7 +94,7 @@ bool IsolatedContext::FileInfoSet::AddPath(
}
bool IsolatedContext::FileInfoSet::AddPathWithName(
- const FilePath& path, const std::string& name) {
+ const base::FilePath& path, const std::string& name) {
// The given path should not contain any '..' and should be absolute.
if (path.ReferencesParent() || !path.IsAbsolute())
return false;
@@ -126,7 +126,7 @@ class IsolatedContext::Instance {
void AddRef() { ++ref_counts_; }
void RemoveRef() { --ref_counts_; }
- bool ResolvePathForName(const std::string& name, FilePath* path) const;
+ bool ResolvePathForName(const std::string& name, base::FilePath* path) const;
// Returns true if the instance is a single-path instance.
bool IsSinglePathInstance() const;
@@ -166,13 +166,13 @@ IsolatedContext::Instance::Instance(FileSystemType type,
IsolatedContext::Instance::~Instance() {}
bool IsolatedContext::Instance::ResolvePathForName(const std::string& name,
- FilePath* path) const {
+ base::FilePath* path) const {
if (IsSinglePathIsolatedFileSystem(type_)) {
*path = file_info_.path;
return file_info_.name == name;
}
std::set<MountPointInfo>::const_iterator found = files_.find(
- MountPointInfo(name, FilePath()));
+ MountPointInfo(name, base::FilePath()));
if (found == files_.end())
return false;
*path = found->path;
@@ -206,15 +206,15 @@ std::string IsolatedContext::RegisterDraggedFileSystem(
std::string IsolatedContext::RegisterFileSystemForPath(
FileSystemType type,
- const FilePath& path_in,
+ const base::FilePath& path_in,
std::string* register_name) {
- FilePath path(path_in.NormalizePathSeparators());
+ base::FilePath path(path_in.NormalizePathSeparators());
DCHECK(!path.ReferencesParent() && path.IsAbsolute());
std::string name;
if (register_name && !register_name->empty()) {
name = *register_name;
} else {
- name = FilePath(GetRegisterNameForPath(path)).AsUTF8Unsafe();
+ name = base::FilePath(GetRegisterNameForPath(path)).AsUTF8Unsafe();
if (register_name)
register_name->assign(name);
}
@@ -236,7 +236,7 @@ bool IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) {
}
bool IsolatedContext::GetRegisteredPath(
- const std::string& filesystem_id, FilePath* path) const {
+ const std::string& filesystem_id, base::FilePath* path) const {
DCHECK(path);
base::AutoLock locker(lock_);
IDToInstance::const_iterator found = instance_map_.find(filesystem_id);
@@ -246,10 +246,10 @@ bool IsolatedContext::GetRegisteredPath(
return true;
}
-bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path,
+bool IsolatedContext::CrackVirtualPath(const base::FilePath& virtual_path,
std::string* id_or_name,
FileSystemType* type,
- FilePath* path) const {
+ base::FilePath* path) const {
DCHECK(id_or_name);
DCHECK(path);
@@ -258,17 +258,17 @@ bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path,
return false;
// The virtual_path should comprise <id_or_name> and <relative_path> parts.
- std::vector<FilePath::StringType> components;
+ std::vector<base::FilePath::StringType> components;
virtual_path.GetComponents(&components);
if (components.size() < 1)
return false;
- std::vector<FilePath::StringType>::iterator component_iter =
+ std::vector<base::FilePath::StringType>::iterator component_iter =
components.begin();
- std::string fsid = FilePath(*component_iter++).MaybeAsASCII();
+ std::string fsid = base::FilePath(*component_iter++).MaybeAsASCII();
if (fsid.empty())
return false;
- FilePath cracked_path;
+ base::FilePath cracked_path;
{
base::AutoLock locker(lock_);
IDToInstance::const_iterator found_instance = instance_map_.find(fsid);
@@ -286,7 +286,7 @@ bool IsolatedContext::CrackVirtualPath(const FilePath& virtual_path,
}
// *component_iter should be a name of the registered path.
- std::string name = FilePath(*component_iter++).AsUTF8Unsafe();
+ std::string name = base::FilePath(*component_iter++).AsUTF8Unsafe();
if (!instance->ResolvePathForName(name, &cracked_path))
return false;
}
@@ -309,13 +309,13 @@ FileSystemURL IsolatedContext::CrackURL(const GURL& url) const {
FileSystemURL IsolatedContext::CreateCrackedFileSystemURL(
const GURL& origin,
FileSystemType type,
- const FilePath& path) const {
+ const base::FilePath& path) const {
if (!HandlesFileSystemMountType(type))
return FileSystemURL();
std::string mount_name;
FileSystemType cracked_type;
- FilePath cracked_path;
+ base::FilePath cracked_path;
if (!CrackVirtualPath(path, &mount_name, &cracked_type, &cracked_path))
return FileSystemURL();
@@ -323,9 +323,9 @@ FileSystemURL IsolatedContext::CreateCrackedFileSystemURL(
mount_name, cracked_type, cracked_path);
}
-void IsolatedContext::RevokeFileSystemByPath(const FilePath& path_in) {
+void IsolatedContext::RevokeFileSystemByPath(const base::FilePath& path_in) {
base::AutoLock locker(lock_);
- FilePath path(path_in.NormalizePathSeparators());
+ base::FilePath path(path_in.NormalizePathSeparators());
PathToID::iterator ids_iter = path_to_id_map_.find(path);
if (ids_iter == path_to_id_map_.end())
return;
@@ -377,9 +377,9 @@ bool IsolatedContext::GetDraggedFileInfo(
return true;
}
-FilePath IsolatedContext::CreateVirtualRootPath(
+base::FilePath IsolatedContext::CreateVirtualRootPath(
const std::string& filesystem_id) const {
- return FilePath().AppendASCII(filesystem_id);
+ return base::FilePath().AppendASCII(filesystem_id);
}
IsolatedContext::IsolatedContext() {
« no previous file with comments | « webkit/fileapi/isolated_context.h ('k') | webkit/fileapi/isolated_context_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698