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

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

Issue 10828043: Wire up the deleteFileSystem operation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Replaced "typedef" by "using". Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
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/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 18 matching lines...) Expand all
29 namespace fileapi { 29 namespace fileapi {
30 30
31 namespace { 31 namespace {
32 32
33 QuotaClient* CreateQuotaClient( 33 QuotaClient* CreateQuotaClient(
34 FileSystemContext* context, 34 FileSystemContext* context,
35 bool is_incognito) { 35 bool is_incognito) {
36 return new FileSystemQuotaClient(context, is_incognito); 36 return new FileSystemQuotaClient(context, is_incognito);
37 } 37 }
38 38
39 void DidOpenFileSystem(FileSystemContext::OpenFileSystemCallback callback, 39 void DidOpenFileSystem(
40 const GURL& filesystem_root, 40 const FileSystemContext::OpenFileSystemCallback& callback,
41 const std::string& filesystem_name, 41 const GURL& filesystem_root,
42 base::PlatformFileError error) { 42 const std::string& filesystem_name,
43 base::PlatformFileError error) {
43 callback.Run(error, filesystem_name, filesystem_root); 44 callback.Run(error, filesystem_name, filesystem_root);
44 } 45 }
45 46
46 } // anonymous namespace 47 } // anonymous namespace
47 48
48 FileSystemContext::FileSystemContext( 49 FileSystemContext::FileSystemContext(
49 base::SequencedTaskRunner* file_task_runner, 50 base::SequencedTaskRunner* file_task_runner,
50 base::SingleThreadTaskRunner* io_task_runner, 51 base::SingleThreadTaskRunner* io_task_runner,
51 quota::SpecialStoragePolicy* special_storage_policy, 52 quota::SpecialStoragePolicy* special_storage_policy,
52 quota::QuotaManagerProxy* quota_manager_proxy, 53 quota::QuotaManagerProxy* quota_manager_proxy,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 143
143 ExternalFileSystemMountPointProvider* 144 ExternalFileSystemMountPointProvider*
144 FileSystemContext::external_provider() const { 145 FileSystemContext::external_provider() const {
145 return external_provider_.get(); 146 return external_provider_.get();
146 } 147 }
147 148
148 void FileSystemContext::OpenFileSystem( 149 void FileSystemContext::OpenFileSystem(
149 const GURL& origin_url, 150 const GURL& origin_url,
150 FileSystemType type, 151 FileSystemType type,
151 bool create, 152 bool create,
152 OpenFileSystemCallback callback) { 153 const OpenFileSystemCallback& callback) {
153 DCHECK(!callback.is_null()); 154 DCHECK(!callback.is_null());
154 155
155 FileSystemMountPointProvider* mount_point_provider = 156 FileSystemMountPointProvider* mount_point_provider =
156 GetMountPointProvider(type); 157 GetMountPointProvider(type);
157 if (!mount_point_provider) { 158 if (!mount_point_provider) {
158 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL()); 159 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY, std::string(), GURL());
159 return; 160 return;
160 } 161 }
161 162
162 GURL root_url = GetFileSystemRootURI(origin_url, type); 163 GURL root_url = GetFileSystemRootURI(origin_url, type);
163 std::string name = GetFileSystemName(origin_url, type); 164 std::string name = GetFileSystemName(origin_url, type);
164 165
165 mount_point_provider->ValidateFileSystemRoot( 166 mount_point_provider->ValidateFileSystemRoot(
166 origin_url, type, create, 167 origin_url, type, create,
167 base::Bind(&DidOpenFileSystem, callback, root_url, name)); 168 base::Bind(&DidOpenFileSystem, callback, root_url, name));
168 } 169 }
169 170
171 void FileSystemContext::DeleteFileSystem(
kinuko 2012/07/30 21:53:38 This could be done in a separate CL but I think we
nhiroki (google) 2012/07/31 15:50:32 I see. I will cleanup in another CL.
172 const GURL& origin_url,
173 FileSystemType type,
174 const DeleteFileSystemCallback& callback) {
175 FileSystemMountPointProvider* mount_point_provider =
176 GetMountPointProvider(type);
177 if (!mount_point_provider) {
178 callback.Run(base::PLATFORM_FILE_ERROR_SECURITY);
179 return;
180 }
181
182 mount_point_provider->DeleteFileSystem(origin_url, type, this, callback);
183 }
184
170 FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation( 185 FileSystemOperationInterface* FileSystemContext::CreateFileSystemOperation(
171 const FileSystemURL& url) { 186 const FileSystemURL& url) {
172 if (!url.is_valid()) 187 if (!url.is_valid())
173 return NULL; 188 return NULL;
174 FileSystemMountPointProvider* mount_point_provider = 189 FileSystemMountPointProvider* mount_point_provider =
175 GetMountPointProvider(url.type()); 190 GetMountPointProvider(url.type());
176 if (!mount_point_provider) 191 if (!mount_point_provider)
177 return NULL; 192 return NULL;
178 return mount_point_provider->CreateFileSystemOperation(url, this); 193 return mount_point_provider->CreateFileSystemOperation(url, this);
179 } 194 }
(...skipping 24 matching lines...) Expand all
204 if (!io_task_runner_->RunsTasksOnCurrentThread() && 219 if (!io_task_runner_->RunsTasksOnCurrentThread() &&
205 io_task_runner_->DeleteSoon(FROM_HERE, this)) { 220 io_task_runner_->DeleteSoon(FROM_HERE, this)) {
206 return; 221 return;
207 } 222 }
208 STLDeleteContainerPairSecondPointers(provider_map_.begin(), 223 STLDeleteContainerPairSecondPointers(provider_map_.begin(),
209 provider_map_.end()); 224 provider_map_.end());
210 delete this; 225 delete this;
211 } 226 }
212 227
213 } // namespace fileapi 228 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698