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 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (file_flags & ~(base::File::FLAG_OPEN | | 128 if (file_flags & ~(base::File::FLAG_OPEN | |
129 base::File::FLAG_READ | | 129 base::File::FLAG_READ | |
130 base::File::FLAG_WRITE_ATTRIBUTES)) { | 130 base::File::FLAG_WRITE_ATTRIBUTES)) { |
131 callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure()); | 131 callback.Run(base::File(base::File::FILE_ERROR_SECURITY), base::Closure()); |
132 return; | 132 return; |
133 } | 133 } |
134 scoped_refptr<base::SequencedTaskRunner> task_runner = context->task_runner(); | 134 scoped_refptr<base::SequencedTaskRunner> task_runner = context->task_runner(); |
135 CreateSnapshotFile( | 135 CreateSnapshotFile( |
136 std::move(context), url, | 136 std::move(context), url, |
137 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen, | 137 base::Bind(&NativeMediaFileUtil::CreatedSnapshotFileForCreateOrOpen, |
138 task_runner, file_flags, callback)); | 138 base::RetainedRef(task_runner), file_flags, callback)); |
139 } | 139 } |
140 | 140 |
141 void NativeMediaFileUtil::EnsureFileExists( | 141 void NativeMediaFileUtil::EnsureFileExists( |
142 scoped_ptr<storage::FileSystemOperationContext> context, | 142 scoped_ptr<storage::FileSystemOperationContext> context, |
143 const storage::FileSystemURL& url, | 143 const storage::FileSystemURL& url, |
144 const EnsureFileExistsCallback& callback) { | 144 const EnsureFileExistsCallback& callback) { |
145 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); | 145 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
146 callback.Run(base::File::FILE_ERROR_SECURITY, false); | 146 callback.Run(base::File::FILE_ERROR_SECURITY, false); |
147 } | 147 } |
148 | 148 |
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
668 return base::File::FILE_ERROR_FAILED; | 668 return base::File::FILE_ERROR_FAILED; |
669 | 669 |
670 if (!file_info.is_directory && | 670 if (!file_info.is_directory && |
671 !media_path_filter_->Match(file_path)) { | 671 !media_path_filter_->Match(file_path)) { |
672 return failure_error; | 672 return failure_error; |
673 } | 673 } |
674 | 674 |
675 *local_file_path = file_path; | 675 *local_file_path = file_path; |
676 return base::File::FILE_OK; | 676 return base::File::FILE_OK; |
677 } | 677 } |
OLD | NEW |