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 "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 5 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
11 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 12 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
12 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 13 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
13 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" | 14 #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h
" |
14 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 15 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
15 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" | 16 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" |
16 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 17 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 DCHECK(CanHandleType(url.type())); | 162 DCHECK(CanHandleType(url.type())); |
162 DCHECK(context); | 163 DCHECK(context); |
163 DCHECK(error_code); | 164 DCHECK(error_code); |
164 | 165 |
165 scoped_ptr<storage::FileSystemOperationContext> operation_context = | 166 scoped_ptr<storage::FileSystemOperationContext> operation_context = |
166 GetDelegate()->CreateFileSystemOperationContext(url, context, error_code); | 167 GetDelegate()->CreateFileSystemOperationContext(url, context, error_code); |
167 if (!operation_context) | 168 if (!operation_context) |
168 return nullptr; | 169 return nullptr; |
169 | 170 |
170 if (url.type() == storage::kFileSystemTypeSyncableForInternalSync) { | 171 if (url.type() == storage::kFileSystemTypeSyncableForInternalSync) { |
171 return storage::FileSystemOperation::Create( | 172 return storage::FileSystemOperation::Create(url, context, |
172 url, context, operation_context.Pass()); | 173 std::move(operation_context)); |
173 } | 174 } |
174 | 175 |
175 return new SyncableFileSystemOperation( | 176 return new SyncableFileSystemOperation(url, context, |
176 url, context, operation_context.Pass()); | 177 std::move(operation_context)); |
177 } | 178 } |
178 | 179 |
179 bool SyncFileSystemBackend::SupportsStreaming( | 180 bool SyncFileSystemBackend::SupportsStreaming( |
180 const storage::FileSystemURL& url) const { | 181 const storage::FileSystemURL& url) const { |
181 return false; | 182 return false; |
182 } | 183 } |
183 | 184 |
184 bool SyncFileSystemBackend::HasInplaceCopyImplementation( | 185 bool SyncFileSystemBackend::HasInplaceCopyImplementation( |
185 storage::FileSystemType type) const { | 186 storage::FileSystemType type) const { |
186 return false; | 187 return false; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 DCHECK(file_system_context); | 234 DCHECK(file_system_context); |
234 return static_cast<SyncFileSystemBackend*>( | 235 return static_cast<SyncFileSystemBackend*>( |
235 file_system_context->GetFileSystemBackend( | 236 file_system_context->GetFileSystemBackend( |
236 storage::kFileSystemTypeSyncable)); | 237 storage::kFileSystemTypeSyncable)); |
237 } | 238 } |
238 | 239 |
239 void SyncFileSystemBackend::SetLocalFileChangeTracker( | 240 void SyncFileSystemBackend::SetLocalFileChangeTracker( |
240 scoped_ptr<LocalFileChangeTracker> tracker) { | 241 scoped_ptr<LocalFileChangeTracker> tracker) { |
241 DCHECK(!change_tracker_); | 242 DCHECK(!change_tracker_); |
242 DCHECK(tracker); | 243 DCHECK(tracker); |
243 change_tracker_ = tracker.Pass(); | 244 change_tracker_ = std::move(tracker); |
244 | 245 |
245 storage::SandboxFileSystemBackendDelegate* delegate = GetDelegate(); | 246 storage::SandboxFileSystemBackendDelegate* delegate = GetDelegate(); |
246 delegate->AddFileUpdateObserver(storage::kFileSystemTypeSyncable, | 247 delegate->AddFileUpdateObserver(storage::kFileSystemTypeSyncable, |
247 change_tracker_.get(), | 248 change_tracker_.get(), |
248 delegate->file_task_runner()); | 249 delegate->file_task_runner()); |
249 delegate->AddFileChangeObserver(storage::kFileSystemTypeSyncable, | 250 delegate->AddFileChangeObserver(storage::kFileSystemTypeSyncable, |
250 change_tracker_.get(), | 251 change_tracker_.get(), |
251 delegate->file_task_runner()); | 252 delegate->file_task_runner()); |
252 } | 253 } |
253 | 254 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 SyncStatusCodeToFileError(status)); | 315 SyncStatusCodeToFileError(status)); |
315 return; | 316 return; |
316 } | 317 } |
317 | 318 |
318 callback.Run(GetSyncableFileSystemRootURI(origin_url), | 319 callback.Run(GetSyncableFileSystemRootURI(origin_url), |
319 GetFileSystemName(origin_url, type), | 320 GetFileSystemName(origin_url, type), |
320 base::File::FILE_OK); | 321 base::File::FILE_OK); |
321 } | 322 } |
322 | 323 |
323 } // namespace sync_file_system | 324 } // namespace sync_file_system |
OLD | NEW |