| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // this method is called or not. | 124 // this method is called or not. |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // anonymous namespace | 127 } // anonymous namespace |
| 128 | 128 |
| 129 const base::FilePath::CharType | 129 const base::FilePath::CharType |
| 130 SandboxMountPointProvider::kFileSystemDirectory[] = | 130 SandboxMountPointProvider::kFileSystemDirectory[] = |
| 131 FILE_PATH_LITERAL("File System"); | 131 FILE_PATH_LITERAL("File System"); |
| 132 | 132 |
| 133 // static | 133 // static |
| 134 bool SandboxMountPointProvider::CanHandleType(FileSystemType type) { | 134 bool SandboxMountPointProvider::IsSandboxType(FileSystemType type) { |
| 135 return type == kFileSystemTypeTemporary || | 135 return type == kFileSystemTypeTemporary || |
| 136 type == kFileSystemTypePersistent || | 136 type == kFileSystemTypePersistent || |
| 137 type == kFileSystemTypeSyncable; | 137 type == kFileSystemTypeSyncable; |
| 138 } | 138 } |
| 139 | 139 |
| 140 SandboxMountPointProvider::SandboxMountPointProvider( | 140 SandboxMountPointProvider::SandboxMountPointProvider( |
| 141 quota::QuotaManagerProxy* quota_manager_proxy, | 141 quota::QuotaManagerProxy* quota_manager_proxy, |
| 142 base::SequencedTaskRunner* file_task_runner, | 142 base::SequencedTaskRunner* file_task_runner, |
| 143 const base::FilePath& profile_path, | 143 const base::FilePath& profile_path, |
| 144 const FileSystemOptions& file_system_options) | 144 const FileSystemOptions& file_system_options) |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 file_system_usage_cache_.release(); | 181 file_system_usage_cache_.release(); |
| 182 if (!file_task_runner_->DeleteSoon(FROM_HERE, sandbox_file_util)) | 182 if (!file_task_runner_->DeleteSoon(FROM_HERE, sandbox_file_util)) |
| 183 delete sandbox_file_util; | 183 delete sandbox_file_util; |
| 184 if (!file_task_runner_->DeleteSoon(FROM_HERE, quota_observer)) | 184 if (!file_task_runner_->DeleteSoon(FROM_HERE, quota_observer)) |
| 185 delete quota_observer; | 185 delete quota_observer; |
| 186 if (!file_task_runner_->DeleteSoon(FROM_HERE, file_system_usage_cache)) | 186 if (!file_task_runner_->DeleteSoon(FROM_HERE, file_system_usage_cache)) |
| 187 delete file_system_usage_cache; | 187 delete file_system_usage_cache; |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 | 190 |
| 191 bool SandboxMountPointProvider::CanHandleType(FileSystemType type) const { |
| 192 return IsSandboxType(type); |
| 193 } |
| 194 |
| 191 void SandboxMountPointProvider::ValidateFileSystemRoot( | 195 void SandboxMountPointProvider::ValidateFileSystemRoot( |
| 192 const GURL& origin_url, fileapi::FileSystemType type, bool create, | 196 const GURL& origin_url, fileapi::FileSystemType type, bool create, |
| 193 const ValidateFileSystemCallback& callback) { | 197 const ValidateFileSystemCallback& callback) { |
| 194 if (file_system_options_.is_incognito()) { | 198 if (file_system_options_.is_incognito()) { |
| 195 // TODO(kinuko): return an isolated temporary directory. | 199 // TODO(kinuko): return an isolated temporary directory. |
| 196 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); | 200 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY); |
| 197 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, | 201 UMA_HISTOGRAM_ENUMERATION(kOpenFileSystemLabel, |
| 198 kIncognito, | 202 kIncognito, |
| 199 kFileSystemErrorMax); | 203 kFileSystemErrorMax); |
| 200 return; | 204 return; |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 FileSystemType type, | 641 FileSystemType type, |
| 638 FileSystemUsageCache* usage_cache) { | 642 FileSystemUsageCache* usage_cache) { |
| 639 base::PlatformFileError error = base::PLATFORM_FILE_OK; | 643 base::PlatformFileError error = base::PLATFORM_FILE_OK; |
| 640 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType( | 644 base::FilePath usage_cache_path = GetUsageCachePathForOriginAndType( |
| 641 file_util, origin, type, &error); | 645 file_util, origin, type, &error); |
| 642 if (error == base::PLATFORM_FILE_OK) | 646 if (error == base::PLATFORM_FILE_OK) |
| 643 usage_cache->IncrementDirty(usage_cache_path); | 647 usage_cache->IncrementDirty(usage_cache_path); |
| 644 } | 648 } |
| 645 | 649 |
| 646 } // namespace fileapi | 650 } // namespace fileapi |
| OLD | NEW |