| Index: storage/browser/fileapi/external_mount_points.cc
|
| diff --git a/webkit/browser/fileapi/external_mount_points.cc b/storage/browser/fileapi/external_mount_points.cc
|
| similarity index 85%
|
| rename from webkit/browser/fileapi/external_mount_points.cc
|
| rename to storage/browser/fileapi/external_mount_points.cc
|
| index 3acfd7f3353c412dee35300ef92a764975daae6d..c698a118e2601098a090e610db06e5984dbcc714 100644
|
| --- a/webkit/browser/fileapi/external_mount_points.cc
|
| +++ b/storage/browser/fileapi/external_mount_points.cc
|
| @@ -2,13 +2,13 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "webkit/browser/fileapi/external_mount_points.h"
|
| +#include "storage/browser/fileapi/external_mount_points.h"
|
|
|
| #include "base/files/file_path.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/path_service.h"
|
| #include "base/stl_util.h"
|
| -#include "webkit/browser/fileapi/file_system_url.h"
|
| +#include "storage/browser/fileapi/file_system_url.h"
|
|
|
| namespace {
|
|
|
| @@ -30,9 +30,9 @@ base::FilePath NormalizeFilePath(const base::FilePath& path) {
|
| return base::FilePath(path_str).NormalizePathSeparators();
|
| }
|
|
|
| -bool IsOverlappingMountPathForbidden(fileapi::FileSystemType type) {
|
| - return type != fileapi::kFileSystemTypeNativeMedia &&
|
| - type != fileapi::kFileSystemTypeDeviceMedia;
|
| +bool IsOverlappingMountPathForbidden(storage::FileSystemType type) {
|
| + return type != storage::kFileSystemTypeNativeMedia &&
|
| + type != storage::kFileSystemTypeDeviceMedia;
|
| }
|
|
|
| // Wrapper around ref-counted ExternalMountPoints that will be used to lazily
|
| @@ -40,17 +40,15 @@ bool IsOverlappingMountPathForbidden(fileapi::FileSystemType type) {
|
| class SystemMountPointsLazyWrapper {
|
| public:
|
| SystemMountPointsLazyWrapper()
|
| - : system_mount_points_(fileapi::ExternalMountPoints::CreateRefCounted()) {
|
| + : system_mount_points_(storage::ExternalMountPoints::CreateRefCounted()) {
|
| }
|
|
|
| ~SystemMountPointsLazyWrapper() {}
|
|
|
| - fileapi::ExternalMountPoints* get() {
|
| - return system_mount_points_.get();
|
| - }
|
| + storage::ExternalMountPoints* get() { return system_mount_points_.get(); }
|
|
|
| private:
|
| - scoped_refptr<fileapi::ExternalMountPoints> system_mount_points_;
|
| + scoped_refptr<storage::ExternalMountPoints> system_mount_points_;
|
| };
|
|
|
| base::LazyInstance<SystemMountPointsLazyWrapper>::Leaky
|
| @@ -58,7 +56,7 @@ base::LazyInstance<SystemMountPointsLazyWrapper>::Leaky
|
|
|
| } // namespace
|
|
|
| -namespace fileapi {
|
| +namespace storage {
|
|
|
| class ExternalMountPoints::Instance {
|
| public:
|
| @@ -134,8 +132,8 @@ bool ExternalMountPoints::RevokeFileSystem(const std::string& mount_name) {
|
| return true;
|
| }
|
|
|
| -bool ExternalMountPoints::GetRegisteredPath(
|
| - const std::string& filesystem_id, base::FilePath* path) const {
|
| +bool ExternalMountPoints::GetRegisteredPath(const std::string& filesystem_id,
|
| + base::FilePath* path) const {
|
| DCHECK(path);
|
| base::AutoLock locker(lock_);
|
| NameToInstance::const_iterator found = instance_map_.find(filesystem_id);
|
| @@ -213,7 +211,8 @@ void ExternalMountPoints::AddMountPointInfosTo(
|
| base::AutoLock locker(lock_);
|
| DCHECK(mount_points);
|
| for (NameToInstance::const_iterator iter = instance_map_.begin();
|
| - iter != instance_map_.end(); ++iter) {
|
| + iter != instance_map_.end();
|
| + ++iter) {
|
| mount_points->push_back(MountPointInfo(iter->first, iter->second->path()));
|
| }
|
| }
|
| @@ -247,11 +246,10 @@ FileSystemURL ExternalMountPoints::CreateExternalFileSystemURL(
|
| const base::FilePath& path) const {
|
| return CreateCrackedFileSystemURL(
|
| origin,
|
| - fileapi::kFileSystemTypeExternal,
|
| + storage::kFileSystemTypeExternal,
|
| // Avoid using FilePath::Append as path may be an absolute path.
|
| - base::FilePath(
|
| - CreateVirtualRootPath(mount_name).value() +
|
| - base::FilePath::kSeparators[0] + path.value()));
|
| + base::FilePath(CreateVirtualRootPath(mount_name).value() +
|
| + base::FilePath::kSeparators[0] + path.value()));
|
| }
|
|
|
| void ExternalMountPoints::RevokeAllFileSystems() {
|
| @@ -266,7 +264,8 @@ void ExternalMountPoints::RevokeAllFileSystems() {
|
| instance_map_copy.end());
|
| }
|
|
|
| -ExternalMountPoints::ExternalMountPoints() {}
|
| +ExternalMountPoints::ExternalMountPoints() {
|
| +}
|
|
|
| ExternalMountPoints::~ExternalMountPoints() {
|
| STLDeleteContainerPairSecondPointers(instance_map_.begin(),
|
| @@ -286,10 +285,14 @@ FileSystemURL ExternalMountPoints::CrackFileSystemURL(
|
| return FileSystemURL();
|
| #else
|
| // On other OS, it is simply a native local path.
|
| - return FileSystemURL(
|
| - url.origin(), url.mount_type(), url.virtual_path(),
|
| - url.mount_filesystem_id(), kFileSystemTypeNativeLocal,
|
| - url.path(), url.filesystem_id(), url.mount_option());
|
| + return FileSystemURL(url.origin(),
|
| + url.mount_type(),
|
| + url.virtual_path(),
|
| + url.mount_filesystem_id(),
|
| + kFileSystemTypeNativeLocal,
|
| + url.path(),
|
| + url.filesystem_id(),
|
| + url.mount_option());
|
| #endif
|
| }
|
|
|
| @@ -299,16 +302,24 @@ FileSystemURL ExternalMountPoints::CrackFileSystemURL(
|
| base::FilePath cracked_path;
|
| FileSystemMountOption cracked_mount_option;
|
|
|
| - if (!CrackVirtualPath(virtual_path, &mount_name, &cracked_type,
|
| - &cracked_id, &cracked_path, &cracked_mount_option)) {
|
| + if (!CrackVirtualPath(virtual_path,
|
| + &mount_name,
|
| + &cracked_type,
|
| + &cracked_id,
|
| + &cracked_path,
|
| + &cracked_mount_option)) {
|
| return FileSystemURL();
|
| }
|
|
|
| return FileSystemURL(
|
| - url.origin(), url.mount_type(), url.virtual_path(),
|
| + url.origin(),
|
| + url.mount_type(),
|
| + url.virtual_path(),
|
| !url.filesystem_id().empty() ? url.filesystem_id() : mount_name,
|
| - cracked_type, cracked_path,
|
| - cracked_id.empty() ? mount_name : cracked_id, cracked_mount_option);
|
| + cracked_type,
|
| + cracked_path,
|
| + cracked_id.empty() ? mount_name : cracked_id,
|
| + cracked_mount_option);
|
| }
|
|
|
| bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name,
|
| @@ -357,4 +368,4 @@ bool ExternalMountPoints::ValidateNewMountPoint(const std::string& mount_name,
|
| return true;
|
| }
|
|
|
| -} // namespace fileapi
|
| +} // namespace storage
|
|
|