OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/public/test/test_file_system_backend.h" | 5 #include "content/public/test/test_file_system_backend.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
| 9 #include <utility> |
9 #include <vector> | 10 #include <vector> |
10 | 11 |
11 #include "base/files/file.h" | 12 #include "base/files/file.h" |
12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
13 #include "base/macros.h" | 14 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
15 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
16 #include "base/sequenced_task_runner.h" | 17 #include "base/sequenced_task_runner.h" |
17 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
18 #include "storage/browser/fileapi/copy_or_move_file_validator.h" | 19 #include "storage/browser/fileapi/copy_or_move_file_validator.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (!copy_or_move_file_validator_factory_) | 165 if (!copy_or_move_file_validator_factory_) |
165 *error_code = base::File::FILE_ERROR_SECURITY; | 166 *error_code = base::File::FILE_ERROR_SECURITY; |
166 return copy_or_move_file_validator_factory_.get(); | 167 return copy_or_move_file_validator_factory_.get(); |
167 } | 168 } |
168 return nullptr; | 169 return nullptr; |
169 } | 170 } |
170 | 171 |
171 void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory( | 172 void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory( |
172 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory) { | 173 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory) { |
173 if (!copy_or_move_file_validator_factory_) | 174 if (!copy_or_move_file_validator_factory_) |
174 copy_or_move_file_validator_factory_ = factory.Pass(); | 175 copy_or_move_file_validator_factory_ = std::move(factory); |
175 } | 176 } |
176 | 177 |
177 FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( | 178 FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( |
178 const FileSystemURL& url, | 179 const FileSystemURL& url, |
179 FileSystemContext* context, | 180 FileSystemContext* context, |
180 base::File::Error* error_code) const { | 181 base::File::Error* error_code) const { |
181 scoped_ptr<FileSystemOperationContext> operation_context( | 182 scoped_ptr<FileSystemOperationContext> operation_context( |
182 new FileSystemOperationContext(context)); | 183 new FileSystemOperationContext(context)); |
183 operation_context->set_update_observers(*GetUpdateObservers(url.type())); | 184 operation_context->set_update_observers(*GetUpdateObservers(url.type())); |
184 operation_context->set_change_observers(*GetChangeObservers(url.type())); | 185 operation_context->set_change_observers(*GetChangeObservers(url.type())); |
185 return FileSystemOperation::Create(url, context, operation_context.Pass()); | 186 return FileSystemOperation::Create(url, context, |
| 187 std::move(operation_context)); |
186 } | 188 } |
187 | 189 |
188 bool TestFileSystemBackend::SupportsStreaming( | 190 bool TestFileSystemBackend::SupportsStreaming( |
189 const storage::FileSystemURL& url) const { | 191 const storage::FileSystemURL& url) const { |
190 return false; | 192 return false; |
191 } | 193 } |
192 | 194 |
193 bool TestFileSystemBackend::HasInplaceCopyImplementation( | 195 bool TestFileSystemBackend::HasInplaceCopyImplementation( |
194 storage::FileSystemType type) const { | 196 storage::FileSystemType type) const { |
195 return true; | 197 return true; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 return nullptr; | 238 return nullptr; |
237 } | 239 } |
238 | 240 |
239 void TestFileSystemBackend::AddFileChangeObserver( | 241 void TestFileSystemBackend::AddFileChangeObserver( |
240 storage::FileChangeObserver* observer) { | 242 storage::FileChangeObserver* observer) { |
241 change_observers_ = | 243 change_observers_ = |
242 change_observers_.AddObserver(observer, task_runner_.get()); | 244 change_observers_.AddObserver(observer, task_runner_.get()); |
243 } | 245 } |
244 | 246 |
245 } // namespace content | 247 } // namespace content |
OLD | NEW |