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" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // file is created successfully, |snapshot_file_path| will be a non-empty file | 38 // file is created successfully, |snapshot_file_path| will be a non-empty file |
39 // path. In case of failure, the |snapshot_file_path| will be an empty file | 39 // path. In case of failure, the |snapshot_file_path| will be an empty file |
40 // path. | 40 // path. |
41 void CreateSnapshotFileOnBlockingPool( | 41 void CreateSnapshotFileOnBlockingPool( |
42 const base::FilePath& device_file_path, | 42 const base::FilePath& device_file_path, |
43 const base::FilePath& profile_path, | 43 const base::FilePath& profile_path, |
44 base::FilePath* snapshot_file_path) { | 44 base::FilePath* snapshot_file_path) { |
45 DCHECK(snapshot_file_path); | 45 DCHECK(snapshot_file_path); |
46 base::FilePath isolated_media_file_system_dir_path = | 46 base::FilePath isolated_media_file_system_dir_path = |
47 profile_path.AppendASCII(kDeviceMediaAsyncFileUtilTempDir); | 47 profile_path.AppendASCII(kDeviceMediaAsyncFileUtilTempDir); |
48 if (!file_util::CreateDirectory(isolated_media_file_system_dir_path) || | 48 if (!base::CreateDirectory(isolated_media_file_system_dir_path) || |
49 !base::CreateTemporaryFileInDir(isolated_media_file_system_dir_path, | 49 !base::CreateTemporaryFileInDir(isolated_media_file_system_dir_path, |
50 snapshot_file_path)) { | 50 snapshot_file_path)) { |
51 LOG(WARNING) << "Could not create media snapshot file " | 51 LOG(WARNING) << "Could not create media snapshot file " |
52 << isolated_media_file_system_dir_path.value(); | 52 << isolated_media_file_system_dir_path.value(); |
53 *snapshot_file_path = base::FilePath(); | 53 *snapshot_file_path = base::FilePath(); |
54 } | 54 } |
55 } | 55 } |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 url.path(), // device file path | 333 url.path(), // device file path |
334 *snapshot_file_path, | 334 *snapshot_file_path, |
335 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, | 335 base::Bind(&DeviceMediaAsyncFileUtil::OnDidCreateSnapshotFile, |
336 weak_ptr_factory_.GetWeakPtr(), | 336 weak_ptr_factory_.GetWeakPtr(), |
337 callback, | 337 callback, |
338 make_scoped_refptr(context->task_runner())), | 338 make_scoped_refptr(context->task_runner())), |
339 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, | 339 base::Bind(&DeviceMediaAsyncFileUtil::OnCreateSnapshotFileError, |
340 weak_ptr_factory_.GetWeakPtr(), | 340 weak_ptr_factory_.GetWeakPtr(), |
341 callback)); | 341 callback)); |
342 } | 342 } |
OLD | NEW |