| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/message_loop_proxy.h" | 8 #include "base/message_loop_proxy.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "webkit/fileapi/file_system_path_manager.h" | 10 #include "webkit/fileapi/file_system_path_manager.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { | 63 bool FileSystemContext::IsStorageUnlimited(const GURL& origin) { |
| 64 // If allow-file-access-from-files flag is explicitly given and the scheme | 64 // If allow-file-access-from-files flag is explicitly given and the scheme |
| 65 // is file, or if unlimited quota for this process was explicitly requested, | 65 // is file, or if unlimited quota for this process was explicitly requested, |
| 66 // return true. | 66 // return true. |
| 67 return unlimited_quota_ || | 67 return unlimited_quota_ || |
| 68 (allow_file_access_from_files_ && origin.SchemeIsFile()) || | 68 (allow_file_access_from_files_ && origin.SchemeIsFile()) || |
| 69 (special_storage_policy_.get() && | 69 (special_storage_policy_.get() && |
| 70 special_storage_policy_->IsStorageUnlimited(origin)); | 70 special_storage_policy_->IsStorageUnlimited(origin)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void FileSystemContext::DeleteDataForOriginOnFileThread( | 73 bool FileSystemContext::DeleteDataForOriginOnFileThread( |
| 74 const GURL& origin_url) { | 74 const GURL& origin_url) { |
| 75 DCHECK(path_manager_.get()); | |
| 76 DCHECK(file_message_loop_->BelongsToCurrentThread()); | 75 DCHECK(file_message_loop_->BelongsToCurrentThread()); |
| 77 | 76 |
| 78 FilePath path_for_origin = | 77 FilePath path_for_origin = |
| 79 sandbox_provider()->GetBaseDirectoryForOrigin(origin_url); | 78 sandbox_provider()->GetBaseDirectoryForOrigin(origin_url); |
| 80 file_util::Delete(path_for_origin, true /* recursive */); | 79 return file_util::Delete(path_for_origin, true /* recursive */); |
| 80 } |
| 81 |
| 82 bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread( |
| 83 const GURL& origin_url, FileSystemType type) { |
| 84 DCHECK(file_message_loop_->BelongsToCurrentThread()); |
| 85 |
| 86 FilePath path_for_origin = |
| 87 sandbox_provider()->GetBaseDirectoryForOriginAndType(origin_url, type); |
| 88 return file_util::Delete(path_for_origin, true /* recursive */); |
| 81 } | 89 } |
| 82 | 90 |
| 83 void FileSystemContext::DeleteOnCorrectThread() const { | 91 void FileSystemContext::DeleteOnCorrectThread() const { |
| 84 if (!io_message_loop_->BelongsToCurrentThread()) { | 92 if (!io_message_loop_->BelongsToCurrentThread()) { |
| 85 io_message_loop_->DeleteSoon(FROM_HERE, this); | 93 io_message_loop_->DeleteSoon(FROM_HERE, this); |
| 86 return; | 94 return; |
| 87 } | 95 } |
| 88 delete this; | 96 delete this; |
| 89 } | 97 } |
| 90 | 98 |
| 91 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { | 99 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { |
| 92 return path_manager_->sandbox_provider(); | 100 return path_manager_->sandbox_provider(); |
| 93 } | 101 } |
| 94 | 102 |
| 95 } // namespace fileapi | 103 } // namespace fileapi |
| OLD | NEW |