| 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 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 url.type(), | 120 url.type(), |
| 121 mode, | 121 mode, |
| 122 callback, | 122 callback, |
| 123 GetSyncableFileSystemRootURI(url.origin())); | 123 GetSyncableFileSystemRootURI(url.origin())); |
| 124 return; | 124 return; |
| 125 } | 125 } |
| 126 | 126 |
| 127 // It is safe to pass Unretained(this) since |context_| owns it. | 127 // It is safe to pass Unretained(this) since |context_| owns it. |
| 128 SyncStatusCallback initialize_callback = | 128 SyncStatusCallback initialize_callback = |
| 129 base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService, | 129 base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService, |
| 130 base::Unretained(this), | 130 base::Unretained(this), base::RetainedRef(context_), |
| 131 make_scoped_refptr(context_), | 131 url.origin(), url.type(), mode, callback); |
| 132 url.origin(), | |
| 133 url.type(), | |
| 134 mode, | |
| 135 callback); | |
| 136 InitializeSyncFileSystemService(url.origin(), initialize_callback); | 132 InitializeSyncFileSystemService(url.origin(), initialize_callback); |
| 137 } | 133 } |
| 138 | 134 |
| 139 storage::AsyncFileUtil* SyncFileSystemBackend::GetAsyncFileUtil( | 135 storage::AsyncFileUtil* SyncFileSystemBackend::GetAsyncFileUtil( |
| 140 storage::FileSystemType type) { | 136 storage::FileSystemType type) { |
| 141 return GetDelegate()->file_util(); | 137 return GetDelegate()->file_util(); |
| 142 } | 138 } |
| 143 | 139 |
| 144 storage::WatcherManager* SyncFileSystemBackend::GetWatcherManager( | 140 storage::WatcherManager* SyncFileSystemBackend::GetWatcherManager( |
| 145 storage::FileSystemType type) { | 141 storage::FileSystemType type) { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 storage::OpenFileSystemMode mode, | 294 storage::OpenFileSystemMode mode, |
| 299 const OpenFileSystemCallback& callback, | 295 const OpenFileSystemCallback& callback, |
| 300 SyncStatusCode status) { | 296 SyncStatusCode status) { |
| 301 // Repost to switch from UI thread to IO thread. | 297 // Repost to switch from UI thread to IO thread. |
| 302 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { | 298 if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) { |
| 303 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 299 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 304 // It is safe to pass Unretained(this) since |context| owns it. | 300 // It is safe to pass Unretained(this) since |context| owns it. |
| 305 BrowserThread::PostTask( | 301 BrowserThread::PostTask( |
| 306 BrowserThread::IO, FROM_HERE, | 302 BrowserThread::IO, FROM_HERE, |
| 307 base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService, | 303 base::Bind(&SyncFileSystemBackend::DidInitializeSyncFileSystemService, |
| 308 base::Unretained(this), make_scoped_refptr(context), | 304 base::Unretained(this), base::RetainedRef(context), |
| 309 origin_url, type, mode, callback, status)); | 305 origin_url, type, mode, callback, status)); |
| 310 return; | 306 return; |
| 311 } | 307 } |
| 312 | 308 |
| 313 if (status != sync_file_system::SYNC_STATUS_OK) { | 309 if (status != sync_file_system::SYNC_STATUS_OK) { |
| 314 callback.Run(GURL(), std::string(), | 310 callback.Run(GURL(), std::string(), |
| 315 SyncStatusCodeToFileError(status)); | 311 SyncStatusCodeToFileError(status)); |
| 316 return; | 312 return; |
| 317 } | 313 } |
| 318 | 314 |
| 319 callback.Run(GetSyncableFileSystemRootURI(origin_url), | 315 callback.Run(GetSyncableFileSystemRootURI(origin_url), |
| 320 GetFileSystemName(origin_url, type), | 316 GetFileSystemName(origin_url, type), |
| 321 base::File::FILE_OK); | 317 base::File::FILE_OK); |
| 322 } | 318 } |
| 323 | 319 |
| 324 } // namespace sync_file_system | 320 } // namespace sync_file_system |
| OLD | NEW |