diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 04:01:07 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-25 04:01:07 +0000 |
commit | 5784e4490e8d63e65497597a1acdc2ce1b420c6f (patch) | |
tree | 6a770faa60c6658d09501804156902d35c91ad0c /webkit | |
parent | a4e1bf741f2ef9712854f5b5a165545a846dd835 (diff) | |
download | chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.zip chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.tar.gz chromium_src-5784e4490e8d63e65497597a1acdc2ce1b420c6f.tar.bz2 |
Add more FS types and introduce type field into IsolatedContext
(Separated from a bigger patch: https://chromiumcodereview.appspot.com/10810053)
BUG=138022
TEST=existing tests
Review URL: https://chromiumcodereview.appspot.com/10817006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148291 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/file_system_context.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/file_system_types.h | 4 | ||||
-rw-r--r-- | webkit/fileapi/file_system_util.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/isolated_context.cc | 180 | ||||
-rw-r--r-- | webkit/fileapi/isolated_context.h | 92 | ||||
-rw-r--r-- | webkit/fileapi/isolated_context_unittest.cc | 35 | ||||
-rw-r--r-- | webkit/fileapi/isolated_file_util.cc | 4 | ||||
-rw-r--r-- | webkit/fileapi/isolated_file_util_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/fileapi/isolated_mount_point_provider.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/obfuscated_file_util.cc | 1 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 4 |
11 files changed, 212 insertions, 115 deletions
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc index 009c073..124fbe0 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -129,6 +129,7 @@ FileSystemMountPointProvider* FileSystemContext::GetMountPointProvider( return provider_map_.find(type)->second; // Fall through. case kFileSystemTypeUnknown: + case kFileSystemTypeDragged: NOTREACHED(); return NULL; } diff --git a/webkit/fileapi/file_system_types.h b/webkit/fileapi/file_system_types.h index eb7b799..85de365 100644 --- a/webkit/fileapi/file_system_types.h +++ b/webkit/fileapi/file_system_types.h @@ -33,6 +33,10 @@ enum FileSystemType { // Should be used only for testing. kFileSystemTypeTest = 100, + + // Internal filesystem types, which are not exposed to WebKit but are + // accessible via Isolated file system. + kFileSystemTypeDragged, }; } // namespace fileapi diff --git a/webkit/fileapi/file_system_util.cc b/webkit/fileapi/file_system_util.cc index 5224b35..ec406ac 100644 --- a/webkit/fileapi/file_system_util.cc +++ b/webkit/fileapi/file_system_util.cc @@ -156,6 +156,7 @@ GURL GetFileSystemRootURI(const GURL& origin_url, FileSystemType type) { url += (kTestDir + 1); // We don't want the leading slash. return GURL(url + "/"); case kFileSystemTypeUnknown: + case kFileSystemTypeDragged: NOTREACHED(); } NOTREACHED(); diff --git a/webkit/fileapi/isolated_context.cc b/webkit/fileapi/isolated_context.cc index d590f44..cc10b12 100644 --- a/webkit/fileapi/isolated_context.cc +++ b/webkit/fileapi/isolated_context.cc @@ -8,6 +8,7 @@ #include "base/basictypes.h" #include "base/logging.h" #include "base/rand_util.h" +#include "base/stl_util.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/stringprintf.h" @@ -51,11 +52,15 @@ IsolatedContext::FileInfo::FileInfo( IsolatedContext::FileInfoSet::FileInfoSet() {} IsolatedContext::FileInfoSet::~FileInfoSet() {} -std::string IsolatedContext::FileInfoSet::AddPath( - const FilePath& path) { +bool IsolatedContext::FileInfoSet::AddPath( + const 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(); - bool inserted = fileset_.insert(FileInfo(utf8name, path)).second; + FilePath normalized_path = path.NormalizePathSeparators(); + bool inserted = fileset_.insert(FileInfo(utf8name, normalized_path)).second; if (!inserted) { int suffix = 1; std::string basepart = FilePath(name).RemoveExtension().AsUTF8Unsafe(); @@ -64,98 +69,122 @@ std::string IsolatedContext::FileInfoSet::AddPath( utf8name = base::StringPrintf("%s (%d)", basepart.c_str(), suffix++); if (!ext.empty()) utf8name.append(ext); - inserted = fileset_.insert(FileInfo(utf8name, path)).second; + inserted = fileset_.insert(FileInfo(utf8name, normalized_path)).second; } } - return utf8name; + if (registered_name) + *registered_name = utf8name; + return true; } bool IsolatedContext::FileInfoSet::AddPathWithName( const FilePath& path, const std::string& name) { - return fileset_.insert(FileInfo(name, path)).second; + // The given path should not contain any '..' and should be absolute. + if (path.ReferencesParent() || !path.IsAbsolute()) + return false; + return fileset_.insert(FileInfo(name, path.NormalizePathSeparators())).second; +} + +//-------------------------------------------------------------------------- + +IsolatedContext::Instance::Instance(FileSystemType type, + const FileInfo& file_info) + : type_(type), + file_info_(file_info), + ref_counts_(0) {} + +IsolatedContext::Instance::Instance(const std::set<FileInfo>& dragged_files) + : type_(kFileSystemTypeDragged), + dragged_files_(dragged_files), + ref_counts_(0) {} + +IsolatedContext::Instance::~Instance() {} + +bool IsolatedContext::Instance::ResolvePathForName(const std::string& name, + FilePath* path) { + if (type_ != kFileSystemTypeDragged) { + *path = file_info_.path; + return file_info_.name == name; + } + std::set<FileInfo>::const_iterator found = dragged_files_.find( + FileInfo(name, FilePath())); + if (found == dragged_files_.end()) + return false; + *path = found->path; + return true; } +//-------------------------------------------------------------------------- + // static IsolatedContext* IsolatedContext::GetInstance() { return g_isolated_context.Pointer(); } -std::string IsolatedContext::RegisterFileSystem(const FileInfoSet& files) { +std::string IsolatedContext::RegisterDraggedFileSystem( + const FileInfoSet& files) { base::AutoLock locker(lock_); std::string filesystem_id = GetNewFileSystemId(); - // Stores name to fullpath map, as we store the name as a key in - // the filesystem's toplevel entries. - FileSet toplevels; - for (std::set<FileInfo>::const_iterator iter = files.fileset().begin(); - iter != files.fileset().end(); - ++iter) { - const FileInfo& info = *iter; - // The given path should not contain any '..' and should be absolute. - if (info.path.ReferencesParent() || !info.path.IsAbsolute()) - continue; - - // Register the basename -> fullpath map. (We only expose the basename - // part to the user scripts) - FilePath fullpath = info.path.NormalizePathSeparators(); - const bool inserted = toplevels.insert( - FileInfo(info.name, fullpath)).second; - DCHECK(inserted); - } - - // TODO(kinuko): we may not want to register the file system if there're - // no valid paths in the given file set. - - toplevel_map_[filesystem_id] = toplevels; - - // Each file system is created with refcount == 0. - ref_counts_[filesystem_id] = 0; - + instance_map_[filesystem_id] = new Instance(files.fileset()); return filesystem_id; } -std::string IsolatedContext::RegisterFileSystemForFile( +std::string IsolatedContext::RegisterFileSystemForPath( + FileSystemType type, const FilePath& path, std::string* register_name) { - FileInfoSet files; + DCHECK(!path.ReferencesParent() && path.IsAbsolute()); + std::string name; if (register_name && !register_name->empty()) { - const bool added = files.AddPathWithName(path, *register_name); - DCHECK(added); + name = *register_name; } else { - std::string name = files.AddPath(path); + name = FilePath(GetRegisterNameForPath(path)).AsUTF8Unsafe(); if (register_name) register_name->assign(name); } - return RegisterFileSystem(files); + + base::AutoLock locker(lock_); + std::string filesystem_id = GetNewFileSystemId(); + instance_map_[filesystem_id] = new Instance(type, FileInfo(name, path)); + return filesystem_id; } void IsolatedContext::RevokeFileSystem(const std::string& filesystem_id) { base::AutoLock locker(lock_); - RevokeWithoutLocking(filesystem_id); + IDToInstance::iterator found = instance_map_.find(filesystem_id); + if (found == instance_map_.end()) + return; + delete found->second; + instance_map_.erase(found); } void IsolatedContext::AddReference(const std::string& filesystem_id) { base::AutoLock locker(lock_); - DCHECK(ref_counts_.find(filesystem_id) != ref_counts_.end()); - ref_counts_[filesystem_id]++; + DCHECK(instance_map_.find(filesystem_id) != instance_map_.end()); + instance_map_[filesystem_id]->AddRef(); } void IsolatedContext::RemoveReference(const std::string& filesystem_id) { base::AutoLock locker(lock_); // This could get called for non-existent filesystem if it has been // already deleted by RevokeFileSystem. - if (ref_counts_.find(filesystem_id) == ref_counts_.end()) + IDToInstance::iterator found = instance_map_.find(filesystem_id); + if (found == instance_map_.end()) return; - DCHECK(ref_counts_[filesystem_id] > 0); - if (--ref_counts_[filesystem_id] == 0) - RevokeWithoutLocking(filesystem_id); + DCHECK(found->second->ref_counts() > 0); + found->second->RemoveRef(); + if (found->second->ref_counts() == 0) { + delete found->second; + instance_map_.erase(found); + } } bool IsolatedContext::CrackIsolatedPath(const FilePath& virtual_path, std::string* filesystem_id, FileInfo* root_info, - FilePath* platform_path) const { + FilePath* path) const { DCHECK(filesystem_id); - DCHECK(platform_path); + DCHECK(path); // This should not contain any '..' references. if (virtual_path.ReferencesParent()) @@ -171,36 +200,49 @@ bool IsolatedContext::CrackIsolatedPath(const FilePath& virtual_path, std::string fsid = FilePath(components[0]).MaybeAsASCII(); if (fsid.empty()) return false; - IDToFileSet::const_iterator found_toplevels = toplevel_map_.find(fsid); - if (found_toplevels == toplevel_map_.end()) + IDToInstance::const_iterator found_instance = instance_map_.find(fsid); + if (found_instance == instance_map_.end()) return false; *filesystem_id = fsid; if (components.size() == 1) { - platform_path->clear(); + path->clear(); return true; } - // components[1] should be a name of the dropped paths. - FileSet::const_iterator found = found_toplevels->second.find( - FileInfo(FilePath(components[1]).AsUTF8Unsafe(), FilePath())); - if (found == found_toplevels->second.end()) + // components[1] should be a name of the registered paths. + FilePath cracked_path; + std::string name = FilePath(components[1]).AsUTF8Unsafe(); + if (!found_instance->second->ResolvePathForName(name, &cracked_path)) return false; if (root_info) - *root_info = *found; - FilePath path = found->path; + *root_info = FileInfo(name, cracked_path); for (size_t i = 2; i < components.size(); ++i) - path = path.Append(components[i]); - *platform_path = path; + cracked_path = cracked_path.Append(components[i]); + *path = cracked_path; return true; } -bool IsolatedContext::GetRegisteredFileInfo( +bool IsolatedContext::GetDraggedFileInfo( const std::string& filesystem_id, std::vector<FileInfo>* files) const { DCHECK(files); base::AutoLock locker(lock_); - IDToFileSet::const_iterator found = toplevel_map_.find(filesystem_id); - if (found == toplevel_map_.end()) + IDToInstance::const_iterator found = instance_map_.find(filesystem_id); + if (found == instance_map_.end() || + found->second->type() != kFileSystemTypeDragged) return false; - files->assign(found->second.begin(), found->second.end()); + files->assign(found->second->dragged_files().begin(), + found->second->dragged_files().end()); + return true; +} + +bool IsolatedContext::GetRegisteredPath( + const std::string& filesystem_id, FilePath* path) const { + DCHECK(path); + base::AutoLock locker(lock_); + IDToInstance::const_iterator found = instance_map_.find(filesystem_id); + if (found == instance_map_.end() || + found->second->type() == kFileSystemTypeDragged) + return false; + *path = found->second->file_info().path; return true; } @@ -213,12 +255,8 @@ IsolatedContext::IsolatedContext() { } IsolatedContext::~IsolatedContext() { -} - -void IsolatedContext::RevokeWithoutLocking( - const std::string& filesystem_id) { - toplevel_map_.erase(filesystem_id); - ref_counts_.erase(filesystem_id); + STLDeleteContainerPairSecondPointers(instance_map_.begin(), + instance_map_.end()); } std::string IsolatedContext::GetNewFileSystemId() const { @@ -228,7 +266,7 @@ std::string IsolatedContext::GetNewFileSystemId() const { do { base::RandBytes(random_data, sizeof(random_data)); id = base::HexEncode(random_data, sizeof(random_data)); - } while (toplevel_map_.find(id) != toplevel_map_.end()); + } while (instance_map_.find(id) != instance_map_.end()); return id; } diff --git a/webkit/fileapi/isolated_context.h b/webkit/fileapi/isolated_context.h index edb7aa9..79ebdb3 100644 --- a/webkit/fileapi/isolated_context.h +++ b/webkit/fileapi/isolated_context.h @@ -15,6 +15,7 @@ #include "base/memory/singleton.h" #include "base/synchronization/lock.h" #include "base/lazy_instance.h" +#include "webkit/fileapi/file_system_types.h" #include "webkit/fileapi/fileapi_export.h" namespace fileapi { @@ -47,12 +48,15 @@ class FILEAPI_EXPORT IsolatedContext { FileInfoSet(); ~FileInfoSet(); - // Add the given |path| to the set and returns the registered name - // assigned for the path. - std::string AddPath(const FilePath& path); + // Add the given |path| to the set and populates |registered_name| with + // the registered name assigned for the path. |path| needs to be + // absolute and should not contain parent references. + // Return false if the |path| is not valid and could not be added. + bool AddPath(const FilePath& path, std::string* registered_name); // Add the given |path| with the |name|. - // Returns false if the |name| is already registered in the set. + // Return false if the |name| is already registered in the set or + // is not valid and could not be added. bool AddPathWithName(const FilePath& path, const std::string& name); const std::set<FileInfo>& fileset() const { return fileset_; } @@ -85,13 +89,16 @@ class FILEAPI_EXPORT IsolatedContext { // // Note that the path in |fileset| that contains '..' or is not an // absolute path is skipped and is not registerred. - std::string RegisterFileSystem(const FileInfoSet& files); + std::string RegisterDraggedFileSystem(const FileInfoSet& files); - // Registers a new isolated filesystem for a given |path|. + // Registers a new isolated filesystem for a given |path| of filesystem + // |type| filesystem and returns a new filesystem ID. + // |path| must be an absolute path which has no parent references ('..'). // If |register_name| is non-null and has non-empty string the path is // registered as the given |register_name|, otherwise it is populated // with the name internally assigned to the path. - std::string RegisterFileSystemForFile(const FilePath& path, + std::string RegisterFileSystemForPath(FileSystemType type, + const FilePath& path, std::string* register_name); // Revokes filesystem specified by the given filesystem_id. @@ -111,25 +118,36 @@ class FILEAPI_EXPORT IsolatedContext { // Cracks the given |virtual_path| (which should look like // "/<filesystem_id>/<registered_name>/<relative_path>") and populates - // the |filesystem_id| and |platform_path| if the embedded <filesystem_id> + // the |filesystem_id| and |path| if the embedded <filesystem_id> // is registerred to this context. |root_path| is also populated to have // the registered root (toplevel) file info for the |virtual_path|. // // Returns false if the given virtual_path or the cracked filesystem_id // is not valid. // - // Note that |root_info| and |platform_path| are set to empty paths if + // Note that |root_info| and |path| are set to empty paths if // |virtual_path| has no <relative_path> part (i.e. pointing to // the virtual root). + // + // TODO(kinuko): Return filesystem type as well. bool CrackIsolatedPath(const FilePath& virtual_path, std::string* filesystem_id, FileInfo* root_info, - FilePath* platform_path) const; + FilePath* path) const; + + // Returns a set of dragged FileInfo's registered for the |filesystem_id|. + // The filesystem_id must be pointing to a dragged file system + // (i.e. must be the one registered by RegisterDraggedFileSystem). + // Returns false if the |filesystem_id| is not valid. + bool GetDraggedFileInfo(const std::string& filesystem_id, + std::vector<FileInfo>* files) const; - // Returns a set of FileInfo registered for the |filesystem_id|. + // Returns the file path registered for the |filesystem_id|. + // The filesystem_id must NOT be pointing to a dragged file system + // (i.e. must be the one registered by RegisterFileSystemForPath). // Returns false if the |filesystem_id| is not valid. - bool GetRegisteredFileInfo(const std::string& filesystem_id, - std::vector<FileInfo>* files) const; + bool GetRegisteredPath(const std::string& filesystem_id, + FilePath* path) const; // Returns the virtual root path that looks like /<filesystem_id>. FilePath CreateVirtualRootPath(const std::string& filesystem_id) const; @@ -137,30 +155,50 @@ class FILEAPI_EXPORT IsolatedContext { private: friend struct base::DefaultLazyInstanceTraits<IsolatedContext>; - // Maps from filesystem id to a path conversion map for top-level entries. - typedef std::set<FileInfo> FileSet; - typedef std::map<std::string, FileSet> IDToFileSet; + // Represents each isolated file system instance. + class Instance { + public: + Instance(FileSystemType type, const FileInfo& file_info); + explicit Instance(const std::set<FileInfo>& dragged_files); + ~Instance(); + + FileSystemType type() const { return type_; } + const FileInfo& file_info() const { return file_info_; } + const std::set<FileInfo>& dragged_files() const { return dragged_files_; } + int ref_counts() const { return ref_counts_; } + + void AddRef() { ++ref_counts_; } + void RemoveRef() { --ref_counts_; } + + bool ResolvePathForName(const std::string& name, FilePath* path); + + private: + const FileSystemType type_; + const FileInfo file_info_; + + // For dragged file system. + const std::set<FileInfo> dragged_files_; + + // Reference counts. Note that an isolated filesystem is created with ref==0 + // and will get deleted when the ref count reaches <=0. + int ref_counts_; + + DISALLOW_COPY_AND_ASSIGN(Instance); + }; + + typedef std::map<std::string, Instance*> IDToInstance; // Obtain an instance of this class via GetInstance(). IsolatedContext(); ~IsolatedContext(); - // Removes the given filesystem without locking. - // (The caller must hold a lock) - void RevokeWithoutLocking(const std::string& filesystem_id); - // Returns a new filesystem_id. Called with lock. std::string GetNewFileSystemId() const; - // This lock needs to be obtained when accessing the toplevel_map_. + // This lock needs to be obtained when accessing the instance_map_. mutable base::Lock lock_; - // Maps the toplevel entries to the filesystem id. - IDToFileSet toplevel_map_; - - // Reference counts. Note that an isolated filesystem is created with ref==0. - // and will get deleted when the ref count reaches <=0. - std::map<std::string, int> ref_counts_; + IDToInstance instance_map_; DISALLOW_COPY_AND_ASSIGN(IsolatedContext); }; diff --git a/webkit/fileapi/isolated_context_unittest.cc b/webkit/fileapi/isolated_context_unittest.cc index ee54557..92c5b56 100644 --- a/webkit/fileapi/isolated_context_unittest.cc +++ b/webkit/fileapi/isolated_context_unittest.cc @@ -51,9 +51,13 @@ class IsolatedContextTest : public testing::Test { void SetUp() { IsolatedContext::FileInfoSet files; - for (size_t i = 0; i < arraysize(kTestPaths); ++i) - names_.push_back(files.AddPath(kTestPaths[i].NormalizePathSeparators())); - id_ = IsolatedContext::GetInstance()->RegisterFileSystem(files); + for (size_t i = 0; i < arraysize(kTestPaths); ++i) { + std::string name; + ASSERT_TRUE( + files.AddPath(kTestPaths[i].NormalizePathSeparators(), &name)); + names_.push_back(name); + } + id_ = IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); ASSERT_FALSE(id_.empty()); } @@ -77,14 +81,14 @@ class IsolatedContextTest : public testing::Test { TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { // See if the returned top-level entries match with what we registered. std::vector<FileInfo> toplevels; - ASSERT_TRUE(isolated_context()->GetRegisteredFileInfo(id_, &toplevels)); + ASSERT_TRUE(isolated_context()->GetDraggedFileInfo(id_, &toplevels)); ASSERT_EQ(fileset_.size(), toplevels.size()); for (size_t i = 0; i < toplevels.size(); ++i) { ASSERT_TRUE(fileset_.find(toplevels[i].path) != fileset_.end()); } // See if the name of each registered kTestPaths (that is what we - // register in SetUp() by RegisterFileSystem) is properly cracked as + // register in SetUp() by RegisterDraggedFileSystem) is properly cracked as // a valid virtual path in the isolated filesystem. for (size_t i = 0; i < arraysize(kTestPaths); ++i) { FilePath virtual_path = isolated_context()->CreateVirtualRootPath(id_) @@ -101,14 +105,23 @@ TEST_F(IsolatedContextTest, RegisterAndRevokeTest) { ASSERT_EQ(id_, cracked_id); } - // Revoking the current one and registering a new (empty) one. + // Make sure GetRegisteredPath returns false for id_ since it is + // registered for dragged files. + FilePath path; + ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path)); + + // Revoking the current one and registering a new one. isolated_context()->RevokeFileSystem(id_); - std::string id2 = isolated_context()->RegisterFileSystem( - IsolatedContext::FileInfoSet()); + std::string id2 = isolated_context()->RegisterFileSystemForPath( + kFileSystemTypeIsolated, FilePath(DRIVE FPL("/foo")), NULL); + + // Make sure the GetDraggedFileInfo returns false for both ones. + ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id2, &toplevels)); + ASSERT_FALSE(isolated_context()->GetDraggedFileInfo(id_, &toplevels)); - // Make sure the GetRegisteredFileInfo returns true only for the new one. - ASSERT_TRUE(isolated_context()->GetRegisteredFileInfo(id2, &toplevels)); - ASSERT_FALSE(isolated_context()->GetRegisteredFileInfo(id_, &toplevels)); + // Make sure the GetRegisteredPath returns true only for the new one. + ASSERT_TRUE(isolated_context()->GetRegisteredPath(id2, &path)); + ASSERT_FALSE(isolated_context()->GetRegisteredPath(id_, &path)); isolated_context()->RevokeFileSystem(id2); } diff --git a/webkit/fileapi/isolated_file_util.cc b/webkit/fileapi/isolated_file_util.cc index 1d50a56..997d5b6 100644 --- a/webkit/fileapi/isolated_file_util.cc +++ b/webkit/fileapi/isolated_file_util.cc @@ -260,7 +260,7 @@ IsolatedFileUtil::CreateFileEnumerator( // Root path case. std::vector<FileInfo> toplevels; - IsolatedContext::GetInstance()->GetRegisteredFileInfo( + IsolatedContext::GetInstance()->GetDraggedFileInfo( filesystem_id, &toplevels); if (!recursive) return new SetFileEnumerator(toplevels, root.path()); @@ -337,7 +337,7 @@ bool IsolatedFileUtil::IsDirectoryEmpty( if (platform_path.empty()) { // The root directory case. std::vector<FileInfo> toplevels; - bool success = IsolatedContext::GetInstance()->GetRegisteredFileInfo( + bool success = IsolatedContext::GetInstance()->GetDraggedFileInfo( filesystem_id, &toplevels); DCHECK(success); return toplevels.empty(); diff --git a/webkit/fileapi/isolated_file_util_unittest.cc b/webkit/fileapi/isolated_file_util_unittest.cc index c7e17b0..8edbcb0 100644 --- a/webkit/fileapi/isolated_file_util_unittest.cc +++ b/webkit/fileapi/isolated_file_util_unittest.cc @@ -206,14 +206,14 @@ class IsolatedFileUtilTest : public testing::Test { FilePath root = root_path().Append( kRootPaths[(root_path_index++) % arraysize(kRootPaths)]); toplevel_root_map_[toplevel] = root; - toplevels.AddPath(root.Append(path)); + toplevels.AddPath(root.Append(path), NULL); } test::SetUpOneTestCase(toplevel_root_map_[toplevel], test_case); } // Register the toplevel entries. - filesystem_id_ = isolated_context()->RegisterFileSystem(toplevels); + filesystem_id_ = isolated_context()->RegisterDraggedFileSystem(toplevels); } ScopedTempDir data_dir_; diff --git a/webkit/fileapi/isolated_mount_point_provider.cc b/webkit/fileapi/isolated_mount_point_provider.cc index 770bbfe..a144a74 100644 --- a/webkit/fileapi/isolated_mount_point_provider.cc +++ b/webkit/fileapi/isolated_mount_point_provider.cc @@ -93,6 +93,7 @@ bool IsolatedMountPointProvider::IsRestrictedFileName( } FileSystemFileUtil* IsolatedMountPointProvider::GetFileUtil() { + // TODO(kinuko): Return different FileUtil's based on types. return isolated_file_util_.get(); } diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index 67969d4..c6cd19a 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -971,6 +971,7 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( case kFileSystemTypeIsolated: case kFileSystemTypeExternal: case kFileSystemTypeTest: + case kFileSystemTypeDragged: NOTREACHED(); } if (!file_util::DirectoryExists( diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index e768fa1..6b9d88f 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -802,10 +802,10 @@ WebKit::WebString RegisterIsolatedFileSystem( fileapi::IsolatedContext::FileInfoSet files; for (size_t i = 0; i < filenames.size(); ++i) { FilePath path = webkit_glue::WebStringToFilePath(filenames[i]); - files.AddPath(path); + files.AddPath(path, NULL); } std::string filesystemId = - fileapi::IsolatedContext::GetInstance()->RegisterFileSystem(files); + fileapi::IsolatedContext::GetInstance()->RegisterDraggedFileSystem(files); return UTF8ToUTF16(filesystemId); } |