OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/native_media_file_util.h" | 5 #include "chrome/browser/media_galleries/fileapi/native_media_file_util.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 } | 409 } |
410 | 410 |
411 void NativeMediaFileUtil::CreateSnapshotFileOnTaskRunnerThread( | 411 void NativeMediaFileUtil::CreateSnapshotFileOnTaskRunnerThread( |
412 scoped_ptr<fileapi::FileSystemOperationContext> context, | 412 scoped_ptr<fileapi::FileSystemOperationContext> context, |
413 const fileapi::FileSystemURL& url, | 413 const fileapi::FileSystemURL& url, |
414 const CreateSnapshotFileCallback& callback) { | 414 const CreateSnapshotFileCallback& callback) { |
415 DCHECK(IsOnTaskRunnerThread(context.get())); | 415 DCHECK(IsOnTaskRunnerThread(context.get())); |
416 base::File::Info file_info; | 416 base::File::Info file_info; |
417 base::FilePath platform_path; | 417 base::FilePath platform_path; |
418 scoped_refptr<webkit_blob::ShareableFileReference> file_ref; | 418 scoped_refptr<webkit_blob::ShareableFileReference> file_ref; |
419 base::File::Error error = | 419 base::File::Error error = CreateSnapshotFileSync( |
420 CreateSnapshotFileSync(context.get(), url, &file_info, &platform_path, | 420 context.get(), url, &file_info, &platform_path, &file_ref); |
421 &file_ref); | |
422 content::BrowserThread::PostTask( | 421 content::BrowserThread::PostTask( |
423 content::BrowserThread::IO, | 422 content::BrowserThread::IO, |
424 FROM_HERE, | 423 FROM_HERE, |
425 base::Bind(callback, error, file_info, platform_path, file_ref)); | 424 base::Bind(callback, error, file_info, platform_path, file_ref)); |
426 } | 425 } |
427 | 426 |
428 base::File::Error NativeMediaFileUtil::CreateDirectorySync( | 427 base::File::Error NativeMediaFileUtil::CreateDirectorySync( |
429 fileapi::FileSystemOperationContext* context, | 428 fileapi::FileSystemOperationContext* context, |
430 const fileapi::FileSystemURL& url, | 429 const fileapi::FileSystemURL& url, |
431 bool exclusive, | 430 bool exclusive, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 return base::File::FILE_ERROR_FAILED; | 669 return base::File::FILE_ERROR_FAILED; |
671 | 670 |
672 if (!file_info.is_directory && | 671 if (!file_info.is_directory && |
673 !media_path_filter_->Match(file_path)) { | 672 !media_path_filter_->Match(file_path)) { |
674 return failure_error; | 673 return failure_error; |
675 } | 674 } |
676 | 675 |
677 *local_file_path = file_path; | 676 *local_file_path = file_path; |
678 return base::File::FILE_OK; | 677 return base::File::FILE_OK; |
679 } | 678 } |
OLD | NEW |