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

Side by Side Diff: chrome/browser/chromeos/drive/fileapi/async_file_util.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chrome/browser/chromeos/drive/fileapi/async_file_util.h" 5 #include "chrome/browser/chromeos/drive/fileapi/async_file_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 126
127 } // namespace 127 } // namespace
128 128
129 AsyncFileUtil::AsyncFileUtil() { 129 AsyncFileUtil::AsyncFileUtil() {
130 } 130 }
131 131
132 AsyncFileUtil::~AsyncFileUtil() { 132 AsyncFileUtil::~AsyncFileUtil() {
133 } 133 }
134 134
135 void AsyncFileUtil::CreateOrOpen( 135 void AsyncFileUtil::CreateOrOpen(
136 scoped_ptr<storage::FileSystemOperationContext> context, 136 std::unique_ptr<storage::FileSystemOperationContext> context,
137 const storage::FileSystemURL& url, 137 const storage::FileSystemURL& url,
138 int file_flags, 138 int file_flags,
139 const CreateOrOpenCallback& callback) { 139 const CreateOrOpenCallback& callback) {
140 DCHECK_CURRENTLY_ON(BrowserThread::IO); 140 DCHECK_CURRENTLY_ON(BrowserThread::IO);
141 141
142 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 142 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
143 if (file_path.empty()) { 143 if (file_path.empty()) {
144 callback.Run(base::File(base::File::FILE_ERROR_NOT_FOUND), base::Closure()); 144 callback.Run(base::File(base::File::FILE_ERROR_NOT_FOUND), base::Closure());
145 return; 145 return;
146 } 146 }
147 147
148 const fileapi_internal::FileSystemGetter getter = 148 const fileapi_internal::FileSystemGetter getter =
149 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url); 149 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url);
150 PostFileSystemCallback( 150 PostFileSystemCallback(
151 getter, 151 getter,
152 base::Bind(&fileapi_internal::OpenFile, 152 base::Bind(&fileapi_internal::OpenFile,
153 file_path, file_flags, 153 file_path, file_flags,
154 google_apis::CreateRelayCallback( 154 google_apis::CreateRelayCallback(
155 base::Bind(&RunCreateOrOpenFileCallback, callback))), 155 base::Bind(&RunCreateOrOpenFileCallback, callback))),
156 base::Bind(&RunCreateOrOpenFileCallbackOnError, 156 base::Bind(&RunCreateOrOpenFileCallbackOnError,
157 callback, base::File::FILE_ERROR_FAILED)); 157 callback, base::File::FILE_ERROR_FAILED));
158 } 158 }
159 159
160 void AsyncFileUtil::EnsureFileExists( 160 void AsyncFileUtil::EnsureFileExists(
161 scoped_ptr<storage::FileSystemOperationContext> context, 161 std::unique_ptr<storage::FileSystemOperationContext> context,
162 const storage::FileSystemURL& url, 162 const storage::FileSystemURL& url,
163 const EnsureFileExistsCallback& callback) { 163 const EnsureFileExistsCallback& callback) {
164 DCHECK_CURRENTLY_ON(BrowserThread::IO); 164 DCHECK_CURRENTLY_ON(BrowserThread::IO);
165 165
166 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 166 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
167 if (file_path.empty()) { 167 if (file_path.empty()) {
168 callback.Run(base::File::FILE_ERROR_NOT_FOUND, false); 168 callback.Run(base::File::FILE_ERROR_NOT_FOUND, false);
169 return; 169 return;
170 } 170 }
171 171
172 PostFileSystemCallback( 172 PostFileSystemCallback(
173 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 173 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
174 base::Bind(&fileapi_internal::CreateFile, 174 base::Bind(&fileapi_internal::CreateFile,
175 file_path, true /* is_exlusive */, 175 file_path, true /* is_exlusive */,
176 google_apis::CreateRelayCallback( 176 google_apis::CreateRelayCallback(
177 base::Bind(&RunEnsureFileExistsCallback, callback))), 177 base::Bind(&RunEnsureFileExistsCallback, callback))),
178 base::Bind(callback, base::File::FILE_ERROR_FAILED, false)); 178 base::Bind(callback, base::File::FILE_ERROR_FAILED, false));
179 } 179 }
180 180
181 void AsyncFileUtil::CreateDirectory( 181 void AsyncFileUtil::CreateDirectory(
182 scoped_ptr<storage::FileSystemOperationContext> context, 182 std::unique_ptr<storage::FileSystemOperationContext> context,
183 const storage::FileSystemURL& url, 183 const storage::FileSystemURL& url,
184 bool exclusive, 184 bool exclusive,
185 bool recursive, 185 bool recursive,
186 const StatusCallback& callback) { 186 const StatusCallback& callback) {
187 DCHECK_CURRENTLY_ON(BrowserThread::IO); 187 DCHECK_CURRENTLY_ON(BrowserThread::IO);
188 188
189 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 189 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
190 if (file_path.empty()) { 190 if (file_path.empty()) {
191 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 191 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
192 return; 192 return;
193 } 193 }
194 194
195 PostFileSystemCallback( 195 PostFileSystemCallback(
196 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 196 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
197 base::Bind(&fileapi_internal::CreateDirectory, 197 base::Bind(&fileapi_internal::CreateDirectory,
198 file_path, exclusive, recursive, 198 file_path, exclusive, recursive,
199 google_apis::CreateRelayCallback(callback)), 199 google_apis::CreateRelayCallback(callback)),
200 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 200 base::Bind(callback, base::File::FILE_ERROR_FAILED));
201 } 201 }
202 202
203 void AsyncFileUtil::GetFileInfo( 203 void AsyncFileUtil::GetFileInfo(
204 scoped_ptr<storage::FileSystemOperationContext> context, 204 std::unique_ptr<storage::FileSystemOperationContext> context,
205 const storage::FileSystemURL& url, 205 const storage::FileSystemURL& url,
206 int /* fields */, 206 int /* fields */,
207 const GetFileInfoCallback& callback) { 207 const GetFileInfoCallback& callback) {
208 DCHECK_CURRENTLY_ON(BrowserThread::IO); 208 DCHECK_CURRENTLY_ON(BrowserThread::IO);
209 209
210 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 210 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
211 if (file_path.empty()) { 211 if (file_path.empty()) {
212 callback.Run(base::File::FILE_ERROR_NOT_FOUND, base::File::Info()); 212 callback.Run(base::File::FILE_ERROR_NOT_FOUND, base::File::Info());
213 return; 213 return;
214 } 214 }
215 215
216 PostFileSystemCallback( 216 PostFileSystemCallback(
217 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 217 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
218 base::Bind(&fileapi_internal::GetFileInfo, 218 base::Bind(&fileapi_internal::GetFileInfo,
219 file_path, google_apis::CreateRelayCallback(callback)), 219 file_path, google_apis::CreateRelayCallback(callback)),
220 base::Bind(callback, base::File::FILE_ERROR_FAILED, 220 base::Bind(callback, base::File::FILE_ERROR_FAILED,
221 base::File::Info())); 221 base::File::Info()));
222 } 222 }
223 223
224 void AsyncFileUtil::ReadDirectory( 224 void AsyncFileUtil::ReadDirectory(
225 scoped_ptr<storage::FileSystemOperationContext> context, 225 std::unique_ptr<storage::FileSystemOperationContext> context,
226 const storage::FileSystemURL& url, 226 const storage::FileSystemURL& url,
227 const ReadDirectoryCallback& callback) { 227 const ReadDirectoryCallback& callback) {
228 DCHECK_CURRENTLY_ON(BrowserThread::IO); 228 DCHECK_CURRENTLY_ON(BrowserThread::IO);
229 229
230 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 230 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
231 if (file_path.empty()) { 231 if (file_path.empty()) {
232 callback.Run(base::File::FILE_ERROR_NOT_FOUND, EntryList(), false); 232 callback.Run(base::File::FILE_ERROR_NOT_FOUND, EntryList(), false);
233 return; 233 return;
234 } 234 }
235 235
236 PostFileSystemCallback( 236 PostFileSystemCallback(
237 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 237 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
238 base::Bind(&fileapi_internal::ReadDirectory, 238 base::Bind(&fileapi_internal::ReadDirectory,
239 file_path, google_apis::CreateRelayCallback(callback)), 239 file_path, google_apis::CreateRelayCallback(callback)),
240 base::Bind(callback, base::File::FILE_ERROR_FAILED, 240 base::Bind(callback, base::File::FILE_ERROR_FAILED,
241 EntryList(), false)); 241 EntryList(), false));
242 } 242 }
243 243
244 void AsyncFileUtil::Touch( 244 void AsyncFileUtil::Touch(
245 scoped_ptr<storage::FileSystemOperationContext> context, 245 std::unique_ptr<storage::FileSystemOperationContext> context,
246 const storage::FileSystemURL& url, 246 const storage::FileSystemURL& url,
247 const base::Time& last_access_time, 247 const base::Time& last_access_time,
248 const base::Time& last_modified_time, 248 const base::Time& last_modified_time,
249 const StatusCallback& callback) { 249 const StatusCallback& callback) {
250 DCHECK_CURRENTLY_ON(BrowserThread::IO); 250 DCHECK_CURRENTLY_ON(BrowserThread::IO);
251 251
252 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 252 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
253 if (file_path.empty()) { 253 if (file_path.empty()) {
254 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 254 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
255 return; 255 return;
256 } 256 }
257 257
258 PostFileSystemCallback( 258 PostFileSystemCallback(
259 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 259 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
260 base::Bind(&fileapi_internal::TouchFile, 260 base::Bind(&fileapi_internal::TouchFile,
261 file_path, last_access_time, last_modified_time, 261 file_path, last_access_time, last_modified_time,
262 google_apis::CreateRelayCallback(callback)), 262 google_apis::CreateRelayCallback(callback)),
263 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 263 base::Bind(callback, base::File::FILE_ERROR_FAILED));
264 } 264 }
265 265
266 void AsyncFileUtil::Truncate( 266 void AsyncFileUtil::Truncate(
267 scoped_ptr<storage::FileSystemOperationContext> context, 267 std::unique_ptr<storage::FileSystemOperationContext> context,
268 const storage::FileSystemURL& url, 268 const storage::FileSystemURL& url,
269 int64_t length, 269 int64_t length,
270 const StatusCallback& callback) { 270 const StatusCallback& callback) {
271 DCHECK_CURRENTLY_ON(BrowserThread::IO); 271 DCHECK_CURRENTLY_ON(BrowserThread::IO);
272 272
273 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 273 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
274 if (file_path.empty()) { 274 if (file_path.empty()) {
275 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 275 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
276 return; 276 return;
277 } 277 }
278 278
279 PostFileSystemCallback( 279 PostFileSystemCallback(
280 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 280 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
281 base::Bind(&fileapi_internal::Truncate, 281 base::Bind(&fileapi_internal::Truncate,
282 file_path, length, google_apis::CreateRelayCallback(callback)), 282 file_path, length, google_apis::CreateRelayCallback(callback)),
283 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 283 base::Bind(callback, base::File::FILE_ERROR_FAILED));
284 } 284 }
285 285
286 void AsyncFileUtil::CopyFileLocal( 286 void AsyncFileUtil::CopyFileLocal(
287 scoped_ptr<storage::FileSystemOperationContext> context, 287 std::unique_ptr<storage::FileSystemOperationContext> context,
288 const storage::FileSystemURL& src_url, 288 const storage::FileSystemURL& src_url,
289 const storage::FileSystemURL& dest_url, 289 const storage::FileSystemURL& dest_url,
290 CopyOrMoveOption option, 290 CopyOrMoveOption option,
291 const CopyFileProgressCallback& progress_callback, 291 const CopyFileProgressCallback& progress_callback,
292 const StatusCallback& callback) { 292 const StatusCallback& callback) {
293 DCHECK_CURRENTLY_ON(BrowserThread::IO); 293 DCHECK_CURRENTLY_ON(BrowserThread::IO);
294 294
295 base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url); 295 base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
296 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url); 296 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
297 if (src_path.empty() || dest_path.empty()) { 297 if (src_path.empty() || dest_path.empty()) {
(...skipping 12 matching lines...) Expand all
310 base::Bind( 310 base::Bind(
311 &fileapi_internal::Copy, 311 &fileapi_internal::Copy,
312 src_path, 312 src_path,
313 dest_path, 313 dest_path,
314 option == storage::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, 314 option == storage::FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED,
315 google_apis::CreateRelayCallback(callback)), 315 google_apis::CreateRelayCallback(callback)),
316 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 316 base::Bind(callback, base::File::FILE_ERROR_FAILED));
317 } 317 }
318 318
319 void AsyncFileUtil::MoveFileLocal( 319 void AsyncFileUtil::MoveFileLocal(
320 scoped_ptr<storage::FileSystemOperationContext> context, 320 std::unique_ptr<storage::FileSystemOperationContext> context,
321 const storage::FileSystemURL& src_url, 321 const storage::FileSystemURL& src_url,
322 const storage::FileSystemURL& dest_url, 322 const storage::FileSystemURL& dest_url,
323 CopyOrMoveOption option, 323 CopyOrMoveOption option,
324 const StatusCallback& callback) { 324 const StatusCallback& callback) {
325 DCHECK_CURRENTLY_ON(BrowserThread::IO); 325 DCHECK_CURRENTLY_ON(BrowserThread::IO);
326 326
327 base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url); 327 base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
328 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url); 328 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
329 if (src_path.empty() || dest_path.empty()) { 329 if (src_path.empty() || dest_path.empty()) {
330 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 330 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
331 return; 331 return;
332 } 332 }
333 333
334 // TODO(kinaba): see the comment in CopyFileLocal(). |src_url| and |dest_url| 334 // TODO(kinaba): see the comment in CopyFileLocal(). |src_url| and |dest_url|
335 // always return the same FileSystem by GetFileSystemFromUrl, but we need to 335 // always return the same FileSystem by GetFileSystemFromUrl, but we need to
336 // change it in order to support cross-profile file sharing etc. 336 // change it in order to support cross-profile file sharing etc.
337 PostFileSystemCallback( 337 PostFileSystemCallback(
338 base::Bind(&fileapi_internal::GetFileSystemFromUrl, dest_url), 338 base::Bind(&fileapi_internal::GetFileSystemFromUrl, dest_url),
339 base::Bind(&fileapi_internal::Move, 339 base::Bind(&fileapi_internal::Move,
340 src_path, dest_path, 340 src_path, dest_path,
341 google_apis::CreateRelayCallback(callback)), 341 google_apis::CreateRelayCallback(callback)),
342 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 342 base::Bind(callback, base::File::FILE_ERROR_FAILED));
343 } 343 }
344 344
345 void AsyncFileUtil::CopyInForeignFile( 345 void AsyncFileUtil::CopyInForeignFile(
346 scoped_ptr<storage::FileSystemOperationContext> context, 346 std::unique_ptr<storage::FileSystemOperationContext> context,
347 const base::FilePath& src_file_path, 347 const base::FilePath& src_file_path,
348 const storage::FileSystemURL& dest_url, 348 const storage::FileSystemURL& dest_url,
349 const StatusCallback& callback) { 349 const StatusCallback& callback) {
350 DCHECK_CURRENTLY_ON(BrowserThread::IO); 350 DCHECK_CURRENTLY_ON(BrowserThread::IO);
351 351
352 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url); 352 base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
353 if (dest_path.empty()) { 353 if (dest_path.empty()) {
354 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 354 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
355 return; 355 return;
356 } 356 }
357 357
358 PostFileSystemCallback( 358 PostFileSystemCallback(
359 base::Bind(&fileapi_internal::GetFileSystemFromUrl, dest_url), 359 base::Bind(&fileapi_internal::GetFileSystemFromUrl, dest_url),
360 base::Bind(&fileapi_internal::CopyInForeignFile, 360 base::Bind(&fileapi_internal::CopyInForeignFile,
361 src_file_path, dest_path, 361 src_file_path, dest_path,
362 google_apis::CreateRelayCallback(callback)), 362 google_apis::CreateRelayCallback(callback)),
363 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 363 base::Bind(callback, base::File::FILE_ERROR_FAILED));
364 } 364 }
365 365
366 void AsyncFileUtil::DeleteFile( 366 void AsyncFileUtil::DeleteFile(
367 scoped_ptr<storage::FileSystemOperationContext> context, 367 std::unique_ptr<storage::FileSystemOperationContext> context,
368 const storage::FileSystemURL& url, 368 const storage::FileSystemURL& url,
369 const StatusCallback& callback) { 369 const StatusCallback& callback) {
370 DCHECK_CURRENTLY_ON(BrowserThread::IO); 370 DCHECK_CURRENTLY_ON(BrowserThread::IO);
371 371
372 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 372 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
373 if (file_path.empty()) { 373 if (file_path.empty()) {
374 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 374 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
375 return; 375 return;
376 } 376 }
377 377
378 PostFileSystemCallback( 378 PostFileSystemCallback(
379 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 379 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
380 base::Bind(&fileapi_internal::Remove, 380 base::Bind(&fileapi_internal::Remove,
381 file_path, false /* not recursive */, 381 file_path, false /* not recursive */,
382 google_apis::CreateRelayCallback(callback)), 382 google_apis::CreateRelayCallback(callback)),
383 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 383 base::Bind(callback, base::File::FILE_ERROR_FAILED));
384 } 384 }
385 385
386 void AsyncFileUtil::DeleteDirectory( 386 void AsyncFileUtil::DeleteDirectory(
387 scoped_ptr<storage::FileSystemOperationContext> context, 387 std::unique_ptr<storage::FileSystemOperationContext> context,
388 const storage::FileSystemURL& url, 388 const storage::FileSystemURL& url,
389 const StatusCallback& callback) { 389 const StatusCallback& callback) {
390 DCHECK_CURRENTLY_ON(BrowserThread::IO); 390 DCHECK_CURRENTLY_ON(BrowserThread::IO);
391 391
392 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 392 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
393 if (file_path.empty()) { 393 if (file_path.empty()) {
394 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 394 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
395 return; 395 return;
396 } 396 }
397 397
398 PostFileSystemCallback( 398 PostFileSystemCallback(
399 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 399 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
400 base::Bind(&fileapi_internal::Remove, 400 base::Bind(&fileapi_internal::Remove,
401 file_path, false /* not recursive */, 401 file_path, false /* not recursive */,
402 google_apis::CreateRelayCallback(callback)), 402 google_apis::CreateRelayCallback(callback)),
403 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 403 base::Bind(callback, base::File::FILE_ERROR_FAILED));
404 } 404 }
405 405
406 void AsyncFileUtil::DeleteRecursively( 406 void AsyncFileUtil::DeleteRecursively(
407 scoped_ptr<storage::FileSystemOperationContext> context, 407 std::unique_ptr<storage::FileSystemOperationContext> context,
408 const storage::FileSystemURL& url, 408 const storage::FileSystemURL& url,
409 const StatusCallback& callback) { 409 const StatusCallback& callback) {
410 DCHECK_CURRENTLY_ON(BrowserThread::IO); 410 DCHECK_CURRENTLY_ON(BrowserThread::IO);
411 411
412 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 412 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
413 if (file_path.empty()) { 413 if (file_path.empty()) {
414 callback.Run(base::File::FILE_ERROR_NOT_FOUND); 414 callback.Run(base::File::FILE_ERROR_NOT_FOUND);
415 return; 415 return;
416 } 416 }
417 417
418 PostFileSystemCallback( 418 PostFileSystemCallback(
419 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 419 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
420 base::Bind(&fileapi_internal::Remove, 420 base::Bind(&fileapi_internal::Remove,
421 file_path, true /* recursive */, 421 file_path, true /* recursive */,
422 google_apis::CreateRelayCallback(callback)), 422 google_apis::CreateRelayCallback(callback)),
423 base::Bind(callback, base::File::FILE_ERROR_FAILED)); 423 base::Bind(callback, base::File::FILE_ERROR_FAILED));
424 } 424 }
425 425
426 void AsyncFileUtil::CreateSnapshotFile( 426 void AsyncFileUtil::CreateSnapshotFile(
427 scoped_ptr<storage::FileSystemOperationContext> context, 427 std::unique_ptr<storage::FileSystemOperationContext> context,
428 const storage::FileSystemURL& url, 428 const storage::FileSystemURL& url,
429 const CreateSnapshotFileCallback& callback) { 429 const CreateSnapshotFileCallback& callback) {
430 DCHECK_CURRENTLY_ON(BrowserThread::IO); 430 DCHECK_CURRENTLY_ON(BrowserThread::IO);
431 431
432 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url); 432 base::FilePath file_path = util::ExtractDrivePathFromFileSystemUrl(url);
433 if (file_path.empty()) { 433 if (file_path.empty()) {
434 callback.Run(base::File::FILE_ERROR_NOT_FOUND, 434 callback.Run(base::File::FILE_ERROR_NOT_FOUND,
435 base::File::Info(), 435 base::File::Info(),
436 base::FilePath(), 436 base::FilePath(),
437 scoped_refptr<storage::ShareableFileReference>()); 437 scoped_refptr<storage::ShareableFileReference>());
438 return; 438 return;
439 } 439 }
440 440
441 PostFileSystemCallback( 441 PostFileSystemCallback(
442 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url), 442 base::Bind(&fileapi_internal::GetFileSystemFromUrl, url),
443 base::Bind(&fileapi_internal::CreateSnapshotFile, 443 base::Bind(&fileapi_internal::CreateSnapshotFile,
444 file_path, 444 file_path,
445 google_apis::CreateRelayCallback( 445 google_apis::CreateRelayCallback(
446 base::Bind(&RunCreateSnapshotFileCallback, callback))), 446 base::Bind(&RunCreateSnapshotFileCallback, callback))),
447 base::Bind(callback, 447 base::Bind(callback,
448 base::File::FILE_ERROR_FAILED, 448 base::File::FILE_ERROR_FAILED,
449 base::File::Info(), 449 base::File::Info(),
450 base::FilePath(), 450 base::FilePath(),
451 scoped_refptr<storage::ShareableFileReference>())); 451 scoped_refptr<storage::ShareableFileReference>()));
452 } 452 }
453 453
454 } // namespace internal 454 } // namespace internal
455 } // namespace drive 455 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698