OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/media_galleries/fileapi/device_media_async_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 const CreateSnapshotFileCallback& callback) { | 425 const CreateSnapshotFileCallback& callback) { |
426 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 426 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
427 MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url); | 427 MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url); |
428 if (!delegate) { | 428 if (!delegate) { |
429 OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_NOT_FOUND); | 429 OnCreateSnapshotFileError(callback, base::File::FILE_ERROR_NOT_FOUND); |
430 return; | 430 return; |
431 } | 431 } |
432 | 432 |
433 scoped_refptr<base::SequencedTaskRunner> task_runner(context->task_runner()); | 433 scoped_refptr<base::SequencedTaskRunner> task_runner(context->task_runner()); |
434 base::PostTaskAndReplyWithResult( | 434 base::PostTaskAndReplyWithResult( |
435 task_runner, | 435 task_runner.get(), |
436 FROM_HERE, | 436 FROM_HERE, |
437 base::Bind(&CreateSnapshotFileOnBlockingPool, url.path(), profile_path_), | 437 base::Bind(&CreateSnapshotFileOnBlockingPool, url.path(), profile_path_), |
438 base::Bind(&OnSnapshotFileCreatedRunTask, | 438 base::Bind(&OnSnapshotFileCreatedRunTask, |
439 base::Passed(&context), | 439 base::Passed(&context), |
440 callback, | 440 callback, |
441 url, | 441 url, |
442 validate_media_files())); | 442 validate_media_files())); |
443 } | 443 } |
444 | 444 |
445 scoped_ptr<storage::FileStreamReader> | 445 scoped_ptr<storage::FileStreamReader> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 FROM_HERE, | 507 FROM_HERE, |
508 base::Bind(&MediaPathFilterWrapper::FilterMediaEntries, | 508 base::Bind(&MediaPathFilterWrapper::FilterMediaEntries, |
509 media_path_filter_wrapper_, | 509 media_path_filter_wrapper_, |
510 file_list), | 510 file_list), |
511 base::Bind(&OnDidCheckMediaForReadDirectory, callback, has_more)); | 511 base::Bind(&OnDidCheckMediaForReadDirectory, callback, has_more)); |
512 } | 512 } |
513 | 513 |
514 bool DeviceMediaAsyncFileUtil::validate_media_files() const { | 514 bool DeviceMediaAsyncFileUtil::validate_media_files() const { |
515 return media_path_filter_wrapper_.get() != NULL; | 515 return media_path_filter_wrapper_.get() != NULL; |
516 } | 516 } |
OLD | NEW |