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/file_system_context.h" | 5 #include "webkit/fileapi/file_system_context.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 if (quota_manager_proxy) { | 63 if (quota_manager_proxy) { |
64 quota_manager_proxy->RegisterClient(CreateQuotaClient( | 64 quota_manager_proxy->RegisterClient(CreateQuotaClient( |
65 file_message_loop, this, options.is_incognito())); | 65 file_message_loop, this, options.is_incognito())); |
66 } | 66 } |
67 #if defined(OS_CHROMEOS) | 67 #if defined(OS_CHROMEOS) |
68 external_provider_.reset( | 68 external_provider_.reset( |
69 new chromeos::CrosMountPointProvider(special_storage_policy)); | 69 new chromeos::CrosMountPointProvider(special_storage_policy)); |
70 #endif | 70 #endif |
71 } | 71 } |
72 | 72 |
73 FileSystemContext::~FileSystemContext() { | |
74 } | |
75 | |
76 bool FileSystemContext::DeleteDataForOriginOnFileThread( | 73 bool FileSystemContext::DeleteDataForOriginOnFileThread( |
77 const GURL& origin_url) { | 74 const GURL& origin_url) { |
78 DCHECK(file_message_loop_->BelongsToCurrentThread()); | 75 DCHECK(file_message_loop_->BelongsToCurrentThread()); |
79 DCHECK(sandbox_provider()); | 76 DCHECK(sandbox_provider()); |
80 | 77 |
81 // Delete temporary and persistent data. | 78 // Delete temporary and persistent data. |
82 return | 79 return |
83 sandbox_provider()->DeleteOriginDataOnFileThread( | 80 sandbox_provider()->DeleteOriginDataOnFileThread( |
84 quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) && | 81 quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) && |
85 sandbox_provider()->DeleteOriginDataOnFileThread( | 82 sandbox_provider()->DeleteOriginDataOnFileThread( |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 SandboxMountPointProvider* | 134 SandboxMountPointProvider* |
138 FileSystemContext::sandbox_provider() const { | 135 FileSystemContext::sandbox_provider() const { |
139 return sandbox_provider_.get(); | 136 return sandbox_provider_.get(); |
140 } | 137 } |
141 | 138 |
142 ExternalFileSystemMountPointProvider* | 139 ExternalFileSystemMountPointProvider* |
143 FileSystemContext::external_provider() const { | 140 FileSystemContext::external_provider() const { |
144 return external_provider_.get(); | 141 return external_provider_.get(); |
145 } | 142 } |
146 | 143 |
147 void FileSystemContext::DeleteOnCorrectThread() const { | |
148 if (!io_message_loop_->BelongsToCurrentThread() && | |
149 io_message_loop_->DeleteSoon(FROM_HERE, this)) { | |
150 return; | |
151 } | |
152 delete this; | |
153 } | |
154 | |
155 void FileSystemContext::OpenFileSystem( | 144 void FileSystemContext::OpenFileSystem( |
156 const GURL& origin_url, | 145 const GURL& origin_url, |
157 FileSystemType type, | 146 FileSystemType type, |
158 bool create, | 147 bool create, |
159 OpenFileSystemCallback callback) { | 148 OpenFileSystemCallback callback) { |
160 DCHECK(!callback.is_null()); | 149 DCHECK(!callback.is_null()); |
161 | 150 |
162 FileSystemMountPointProvider* mount_point_provider = | 151 FileSystemMountPointProvider* mount_point_provider = |
163 GetMountPointProvider(type); | 152 GetMountPointProvider(type); |
164 if (!mount_point_provider) { | 153 if (!mount_point_provider) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 FilePath file_path; | 188 FilePath file_path; |
200 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) | 189 if (!CrackFileSystemURL(url, &origin_url, &file_system_type, &file_path)) |
201 return NULL; | 190 return NULL; |
202 FileSystemMountPointProvider* mount_point_provider = | 191 FileSystemMountPointProvider* mount_point_provider = |
203 GetMountPointProvider(file_system_type); | 192 GetMountPointProvider(file_system_type); |
204 if (!mount_point_provider) | 193 if (!mount_point_provider) |
205 return NULL; | 194 return NULL; |
206 return mount_point_provider->CreateFileReader(url, offset, file_proxy, this); | 195 return mount_point_provider->CreateFileReader(url, offset, file_proxy, this); |
207 } | 196 } |
208 | 197 |
| 198 FileSystemContext::~FileSystemContext() {} |
| 199 |
| 200 void FileSystemContext::DeleteOnCorrectThread() const { |
| 201 if (!io_message_loop_->BelongsToCurrentThread() && |
| 202 io_message_loop_->DeleteSoon(FROM_HERE, this)) { |
| 203 return; |
| 204 } |
| 205 delete this; |
| 206 } |
| 207 |
209 } // namespace fileapi | 208 } // namespace fileapi |
OLD | NEW |