Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Side by Side Diff: content/public/test/test_file_system_backend.cc

Issue 1874903002: Convert //content from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix indent Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/test_file_system_backend.h ('k') | content/public/test/test_launcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility>
10 #include <vector> 10 #include <vector>
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 *error_code = base::File::FILE_OK; 163 *error_code = base::File::FILE_OK;
164 if (require_copy_or_move_validator_) { 164 if (require_copy_or_move_validator_) {
165 if (!copy_or_move_file_validator_factory_) 165 if (!copy_or_move_file_validator_factory_)
166 *error_code = base::File::FILE_ERROR_SECURITY; 166 *error_code = base::File::FILE_ERROR_SECURITY;
167 return copy_or_move_file_validator_factory_.get(); 167 return copy_or_move_file_validator_factory_.get();
168 } 168 }
169 return nullptr; 169 return nullptr;
170 } 170 }
171 171
172 void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory( 172 void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory(
173 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory) { 173 std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory) {
174 if (!copy_or_move_file_validator_factory_) 174 if (!copy_or_move_file_validator_factory_)
175 copy_or_move_file_validator_factory_ = std::move(factory); 175 copy_or_move_file_validator_factory_ = std::move(factory);
176 } 176 }
177 177
178 FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( 178 FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation(
179 const FileSystemURL& url, 179 const FileSystemURL& url,
180 FileSystemContext* context, 180 FileSystemContext* context,
181 base::File::Error* error_code) const { 181 base::File::Error* error_code) const {
182 scoped_ptr<FileSystemOperationContext> operation_context( 182 std::unique_ptr<FileSystemOperationContext> operation_context(
183 new FileSystemOperationContext(context)); 183 new FileSystemOperationContext(context));
184 operation_context->set_update_observers(*GetUpdateObservers(url.type())); 184 operation_context->set_update_observers(*GetUpdateObservers(url.type()));
185 operation_context->set_change_observers(*GetChangeObservers(url.type())); 185 operation_context->set_change_observers(*GetChangeObservers(url.type()));
186 return FileSystemOperation::Create(url, context, 186 return FileSystemOperation::Create(url, context,
187 std::move(operation_context)); 187 std::move(operation_context));
188 } 188 }
189 189
190 bool TestFileSystemBackend::SupportsStreaming( 190 bool TestFileSystemBackend::SupportsStreaming(
191 const storage::FileSystemURL& url) const { 191 const storage::FileSystemURL& url) const {
192 return false; 192 return false;
193 } 193 }
194 194
195 bool TestFileSystemBackend::HasInplaceCopyImplementation( 195 bool TestFileSystemBackend::HasInplaceCopyImplementation(
196 storage::FileSystemType type) const { 196 storage::FileSystemType type) const {
197 return true; 197 return true;
198 } 198 }
199 199
200 scoped_ptr<storage::FileStreamReader> 200 std::unique_ptr<storage::FileStreamReader>
201 TestFileSystemBackend::CreateFileStreamReader( 201 TestFileSystemBackend::CreateFileStreamReader(
202 const FileSystemURL& url, 202 const FileSystemURL& url,
203 int64_t offset, 203 int64_t offset,
204 int64_t max_bytes_to_read, 204 int64_t max_bytes_to_read,
205 const base::Time& expected_modification_time, 205 const base::Time& expected_modification_time,
206 FileSystemContext* context) const { 206 FileSystemContext* context) const {
207 return scoped_ptr<storage::FileStreamReader>( 207 return std::unique_ptr<storage::FileStreamReader>(
208 storage::FileStreamReader::CreateForFileSystemFile( 208 storage::FileStreamReader::CreateForFileSystemFile(
209 context, url, offset, expected_modification_time)); 209 context, url, offset, expected_modification_time));
210 } 210 }
211 211
212 scoped_ptr<storage::FileStreamWriter> 212 std::unique_ptr<storage::FileStreamWriter>
213 TestFileSystemBackend::CreateFileStreamWriter( 213 TestFileSystemBackend::CreateFileStreamWriter(
214 const FileSystemURL& url, 214 const FileSystemURL& url,
215 int64_t offset, 215 int64_t offset,
216 FileSystemContext* context) const { 216 FileSystemContext* context) const {
217 return scoped_ptr<storage::FileStreamWriter>( 217 return std::unique_ptr<storage::FileStreamWriter>(
218 new storage::SandboxFileStreamWriter( 218 new storage::SandboxFileStreamWriter(context, url, offset,
219 context, url, offset, *GetUpdateObservers(url.type()))); 219 *GetUpdateObservers(url.type())));
220 } 220 }
221 221
222 storage::FileSystemQuotaUtil* TestFileSystemBackend::GetQuotaUtil() { 222 storage::FileSystemQuotaUtil* TestFileSystemBackend::GetQuotaUtil() {
223 return quota_util_.get(); 223 return quota_util_.get();
224 } 224 }
225 225
226 const storage::UpdateObserverList* TestFileSystemBackend::GetUpdateObservers( 226 const storage::UpdateObserverList* TestFileSystemBackend::GetUpdateObservers(
227 storage::FileSystemType type) const { 227 storage::FileSystemType type) const {
228 return &update_observers_; 228 return &update_observers_;
229 } 229 }
230 230
231 const storage::ChangeObserverList* TestFileSystemBackend::GetChangeObservers( 231 const storage::ChangeObserverList* TestFileSystemBackend::GetChangeObservers(
232 storage::FileSystemType type) const { 232 storage::FileSystemType type) const {
233 return &change_observers_; 233 return &change_observers_;
234 } 234 }
235 235
236 const storage::AccessObserverList* TestFileSystemBackend::GetAccessObservers( 236 const storage::AccessObserverList* TestFileSystemBackend::GetAccessObservers(
237 storage::FileSystemType type) const { 237 storage::FileSystemType type) const {
238 return nullptr; 238 return nullptr;
239 } 239 }
240 240
241 void TestFileSystemBackend::AddFileChangeObserver( 241 void TestFileSystemBackend::AddFileChangeObserver(
242 storage::FileChangeObserver* observer) { 242 storage::FileChangeObserver* observer) {
243 change_observers_ = 243 change_observers_ =
244 change_observers_.AddObserver(observer, task_runner_.get()); 244 change_observers_.AddObserver(observer, task_runner_.get());
245 } 245 }
246 246
247 } // namespace content 247 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_file_system_backend.h ('k') | content/public/test/test_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698