| 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 delegate->CreateDirectory( | 349 delegate->CreateDirectory( |
| 350 url.path(), exclusive, recursive, | 350 url.path(), exclusive, recursive, |
| 351 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateDirectory, | 351 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateDirectory, |
| 352 weak_ptr_factory_.GetWeakPtr(), callback), | 352 weak_ptr_factory_.GetWeakPtr(), callback), |
| 353 base::Bind(&OnCreateDirectoryError, callback)); | 353 base::Bind(&OnCreateDirectoryError, callback)); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void DeviceMediaAsyncFileUtil::GetFileInfo( | 356 void DeviceMediaAsyncFileUtil::GetFileInfo( |
| 357 scoped_ptr<FileSystemOperationContext> context, | 357 scoped_ptr<FileSystemOperationContext> context, |
| 358 const FileSystemURL& url, | 358 const FileSystemURL& url, |
| 359 int /* flags */, |
| 359 const GetFileInfoCallback& callback) { | 360 const GetFileInfoCallback& callback) { |
| 360 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 361 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 361 MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url); | 362 MTPDeviceAsyncDelegate* delegate = GetMTPDeviceDelegate(url); |
| 362 if (!delegate) { | 363 if (!delegate) { |
| 363 OnGetFileInfoError(callback, base::File::FILE_ERROR_NOT_FOUND); | 364 OnGetFileInfoError(callback, base::File::FILE_ERROR_NOT_FOUND); |
| 364 return; | 365 return; |
| 365 } | 366 } |
| 366 delegate->GetFileInfo( | 367 delegate->GetFileInfo( |
| 367 url.path(), | 368 url.path(), |
| 368 base::Bind(&DeviceMediaAsyncFileUtil::OnDidGetFileInfo, | 369 base::Bind(&DeviceMediaAsyncFileUtil::OnDidGetFileInfo, |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 void DeviceMediaAsyncFileUtil::OnDidDeleteDirectory( | 699 void DeviceMediaAsyncFileUtil::OnDidDeleteDirectory( |
| 699 const StatusCallback& callback) { | 700 const StatusCallback& callback) { |
| 700 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 701 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
| 701 | 702 |
| 702 callback.Run(base::File::FILE_OK); | 703 callback.Run(base::File::FILE_OK); |
| 703 } | 704 } |
| 704 | 705 |
| 705 bool DeviceMediaAsyncFileUtil::validate_media_files() const { | 706 bool DeviceMediaAsyncFileUtil::validate_media_files() const { |
| 706 return media_path_filter_wrapper_.get() != NULL; | 707 return media_path_filter_wrapper_.get() != NULL; |
| 707 } | 708 } |
| OLD | NEW |