Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(731)

Side by Side Diff: webkit/fileapi/file_system_context.cc

Issue 7003021: Added DeleteOriginData to QuotaClient (Closed)
Patch Set: Apply patch from issue 7013018 Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
kinuko 2011/05/12 08:59:22 nit: extra empty line
tzik (google) 2011/05/12 10:47:06 Done.
82
83 bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread(
84 const GURL& origin_url, FileSystemType type) {
85 DCHECK(file_message_loop_->BelongsToCurrentThread());
86
87 FilePath path_for_origin =
88 sandbox_provider()->GetBaseDirectoryForOriginAndType(origin_url, type);
89 return file_util::Delete(path_for_origin, true /* recursive */);
81 } 90 }
82 91
83 void FileSystemContext::DeleteOnCorrectThread() const { 92 void FileSystemContext::DeleteOnCorrectThread() const {
84 if (!io_message_loop_->BelongsToCurrentThread()) { 93 if (!io_message_loop_->BelongsToCurrentThread()) {
85 io_message_loop_->DeleteSoon(FROM_HERE, this); 94 io_message_loop_->DeleteSoon(FROM_HERE, this);
86 return; 95 return;
87 } 96 }
88 delete this; 97 delete this;
89 } 98 }
90 99
91 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const { 100 SandboxMountPointProvider* FileSystemContext::sandbox_provider() const {
92 return path_manager_->sandbox_provider(); 101 return path_manager_->sandbox_provider();
93 } 102 }
94 103
95 } // namespace fileapi 104 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698