| 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/browser/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/browser/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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 235 |
| 236 // Schedule full usage recalculation on the next launch without | 236 // Schedule full usage recalculation on the next launch without |
| 237 // --disable-file-system-usage-tracking. | 237 // --disable-file-system-usage-tracking. |
| 238 file_task_runner_->PostTask( | 238 file_task_runner_->PostTask( |
| 239 FROM_HERE, | 239 FROM_HERE, |
| 240 base::Bind(&SandboxMountPointProvider::InvalidateUsageCacheOnFileThread, | 240 base::Bind(&SandboxMountPointProvider::InvalidateUsageCacheOnFileThread, |
| 241 sandbox_sync_file_util(), origin_url, type, | 241 sandbox_sync_file_util(), origin_url, type, |
| 242 file_system_usage_cache_.get())); | 242 file_system_usage_cache_.get())); |
| 243 }; | 243 }; |
| 244 | 244 |
| 245 base::FilePath | |
| 246 SandboxMountPointProvider::GetFileSystemRootPathOnFileThread( | |
| 247 const FileSystemURL& url, | |
| 248 bool create) { | |
| 249 if (file_system_options_.is_incognito() && | |
| 250 !(enable_temporary_file_system_in_incognito_ && | |
| 251 url.type() == kFileSystemTypeTemporary)) { | |
| 252 // TODO(kinuko): return an isolated temporary directory. | |
| 253 return base::FilePath(); | |
| 254 } | |
| 255 | |
| 256 if (!IsAllowedScheme(url.origin())) | |
| 257 return base::FilePath(); | |
| 258 | |
| 259 return GetBaseDirectoryForOriginAndType(url.origin(), url.type(), create); | |
| 260 } | |
| 261 | |
| 262 FileSystemFileUtil* SandboxMountPointProvider::GetFileUtil( | 245 FileSystemFileUtil* SandboxMountPointProvider::GetFileUtil( |
| 263 FileSystemType type) { | 246 FileSystemType type) { |
| 264 DCHECK(sandbox_file_util_.get()); | 247 DCHECK(sandbox_file_util_.get()); |
| 265 return sandbox_file_util_->sync_file_util(); | 248 return sandbox_file_util_->sync_file_util(); |
| 266 } | 249 } |
| 267 | 250 |
| 268 AsyncFileUtil* SandboxMountPointProvider::GetAsyncFileUtil( | 251 AsyncFileUtil* SandboxMountPointProvider::GetAsyncFileUtil( |
| 269 FileSystemType type) { | 252 FileSystemType type) { |
| 270 return sandbox_file_util_.get(); | 253 return sandbox_file_util_.get(); |
| 271 } | 254 } |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 | 674 |
| 692 while (!(file_path_each = enumerator->Next()).empty()) { | 675 while (!(file_path_each = enumerator->Next()).empty()) { |
| 693 usage += enumerator->Size(); | 676 usage += enumerator->Size(); |
| 694 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); | 677 usage += ObfuscatedFileUtil::ComputeFilePathCost(file_path_each); |
| 695 } | 678 } |
| 696 | 679 |
| 697 return usage; | 680 return usage; |
| 698 } | 681 } |
| 699 | 682 |
| 700 } // namespace fileapi | 683 } // namespace fileapi |
| OLD | NEW |