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/sandbox_quota_client.h" | 5 #include "webkit/fileapi/sandbox_quota_client.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 DCHECK(pending_origins_for_type_callbacks_.HasCallbacks(type)); | 282 DCHECK(pending_origins_for_type_callbacks_.HasCallbacks(type)); |
283 pending_origins_for_type_callbacks_.Run(type, origins); | 283 pending_origins_for_type_callbacks_.Run(type, origins); |
284 } | 284 } |
285 | 285 |
286 void SandboxQuotaClient::DidGetOriginsForHost( | 286 void SandboxQuotaClient::DidGetOriginsForHost( |
287 const TypeAndHostOrOrigin& type_and_host, const std::set<GURL>& origins) { | 287 const TypeAndHostOrOrigin& type_and_host, const std::set<GURL>& origins) { |
288 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); | 288 DCHECK(pending_origins_for_host_callbacks_.HasCallbacks(type_and_host)); |
289 pending_origins_for_host_callbacks_.Run(type_and_host, origins); | 289 pending_origins_for_host_callbacks_.Run(type_and_host, origins); |
290 } | 290 } |
291 | 291 |
292 class SandboxQuotaClient::DeleteOriginTask | |
293 : public QuotaThreadTask { | |
294 public: | |
295 DeleteOriginTask( | |
296 SandboxQuotaClient* quota_client, | |
297 scoped_refptr<MessageLoopProxy> file_message_loop, | |
298 const GURL& origin, | |
299 FileSystemType type, | |
300 DeletionCallback* callback) | |
301 : QuotaThreadTask(quota_client, file_message_loop), | |
302 file_system_context_(quota_client->file_system_context_), | |
303 origin_(origin), type_(type), | |
304 callback_(callback) { | |
305 } | |
306 | |
307 virtual ~DeleteOriginTask() {} | |
308 | |
309 virtual void RunOnTargetThread() OVERRIDE { | |
310 file_system_context_ | |
311 ->DeleteDataForOriginAndTypeOnFileThread(origin_, type_); | |
kinuko
2011/05/11 09:38:15
what if we fail to do this?
| |
312 } | |
313 | |
314 virtual void Completed() OVERRIDE { | |
315 callback_->Run(); | |
316 delete callback_; | |
317 } | |
318 private: | |
319 FileSystemContext* file_system_context_; | |
320 GURL origin_; | |
321 FileSystemType type_; | |
322 DeletionCallback* callback_; | |
323 }; | |
324 | |
325 void SandboxQuotaClient::DeleteOriginData(const GURL& origin, | |
326 StorageType type, | |
327 DeletionCallback* callback) { | |
328 FileSystemType fs_type = QuotaStorageTypeToFileSystemType(type); | |
kinuko
2011/05/11 09:38:15
DCHECK(fs_type != kFileSystemTypeUnknown)
tzik (google)
2011/05/11 11:32:25
Done.
| |
329 scoped_ptr<DeleteOriginTask> task( | |
330 new DeleteOriginTask(this, file_message_loop_, | |
331 origin, fs_type, callback)); | |
332 task->Start(); | |
333 } | |
334 | |
292 } // namespace fileapi | 335 } // namespace fileapi |
OLD | NEW |