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/file_util.h" | 8 #include "base/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" |
11 #include "chrome/browser/media_galleries/fileapi/media_file_system_mount_point_p
rovider.h" | 11 #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" |
12 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" | 12 #include "chrome/browser/media_galleries/fileapi/media_path_filter.h" |
13 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" | 13 #include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h" |
14 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" | 14 #include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h" |
15 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" | 15 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
16 #include "webkit/browser/fileapi/file_system_context.h" | 16 #include "webkit/browser/fileapi/file_system_context.h" |
17 #include "webkit/browser/fileapi/file_system_operation_context.h" | 17 #include "webkit/browser/fileapi/file_system_operation_context.h" |
18 #include "webkit/browser/fileapi/file_system_task_runners.h" | 18 #include "webkit/browser/fileapi/file_system_task_runners.h" |
19 #include "webkit/browser/fileapi/file_system_url.h" | 19 #include "webkit/browser/fileapi/file_system_url.h" |
20 #include "webkit/browser/fileapi/isolated_context.h" | 20 #include "webkit/browser/fileapi/isolated_context.h" |
21 #include "webkit/browser/fileapi/native_file_util.h" | 21 #include "webkit/browser/fileapi/native_file_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
37 return context->file_system_context()->task_runners()-> | 37 return context->file_system_context()->task_runners()-> |
38 io_task_runner()->RunsTasksOnCurrentThread(); | 38 io_task_runner()->RunsTasksOnCurrentThread(); |
39 } | 39 } |
40 | 40 |
41 // Called on the IO thread. | 41 // Called on the IO thread. |
42 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( | 42 MTPDeviceAsyncDelegate* GetMTPDeviceDelegate( |
43 FileSystemOperationContext* context) { | 43 FileSystemOperationContext* context) { |
44 DCHECK(IsOnIOThread(context)); | 44 DCHECK(IsOnIOThread(context)); |
45 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( | 45 return MTPDeviceMapService::GetInstance()->GetMTPDeviceAsyncDelegate( |
46 context->GetUserValue<std::string>( | 46 context->GetUserValue<std::string>( |
47 MediaFileSystemMountPointProvider::kMTPDeviceDelegateURLKey)); | 47 MediaFileSystemBackend::kMTPDeviceDelegateURLKey)); |
48 } | 48 } |
49 | 49 |
50 // Called on a blocking pool thread to create a snapshot file to hold the | 50 // Called on a blocking pool thread to create a snapshot file to hold the |
51 // contents of |device_file_path|. The snapshot file is created in | 51 // contents of |device_file_path|. The snapshot file is created in |
52 // "profile_path/kDeviceMediaAsyncFileUtilTempDir" directory. If the snapshot | 52 // "profile_path/kDeviceMediaAsyncFileUtilTempDir" directory. If the snapshot |
53 // file is created successfully, |snapshot_file_path| will be a non-empty file | 53 // file is created successfully, |snapshot_file_path| will be a non-empty file |
54 // path. In case of failure, the |snapshot_file_path| will be an empty file | 54 // path. In case of failure, the |snapshot_file_path| will be an empty file |
55 // path. | 55 // path. |
56 void CreateSnapshotFileOnBlockingPool( | 56 void CreateSnapshotFileOnBlockingPool( |
57 const base::FilePath& device_file_path, | 57 const base::FilePath& device_file_path, |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, | 386 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, |
387 weak_ptr_factory_.GetWeakPtr(), | 387 weak_ptr_factory_.GetWeakPtr(), |
388 callback, | 388 callback, |
389 make_scoped_refptr(context->task_runner())), | 389 make_scoped_refptr(context->task_runner())), |
390 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, | 390 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, |
391 weak_ptr_factory_.GetWeakPtr(), | 391 weak_ptr_factory_.GetWeakPtr(), |
392 callback)); | 392 callback)); |
393 } | 393 } |
394 | 394 |
395 } // namespace chrome | 395 } // namespace chrome |
OLD | NEW |