| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 9 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 10 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 10 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 DCHECK(CalledOnUIThread()); | 59 DCHECK(CalledOnUIThread()); |
| 60 return profile_; | 60 return profile_; |
| 61 } | 61 } |
| 62 | 62 |
| 63 SyncFileSystemBackend::SyncFileSystemBackend(Profile* profile) | 63 SyncFileSystemBackend::SyncFileSystemBackend(Profile* profile) |
| 64 : context_(NULL), | 64 : context_(NULL), |
| 65 skip_initialize_syncfs_service_for_testing_(false) { | 65 skip_initialize_syncfs_service_for_testing_(false) { |
| 66 DCHECK(CalledOnUIThread()); | 66 DCHECK(CalledOnUIThread()); |
| 67 if (profile) | 67 if (profile) |
| 68 profile_holder_.reset(new ProfileHolder(profile)); | 68 profile_holder_.reset(new ProfileHolder(profile)); |
| 69 |
| 70 // Register the service name here to enable to crack an URL on SyncFileSystem |
| 71 // even if SyncFileSystemService has not started yet. |
| 72 RegisterSyncableFileSystem(); |
| 69 } | 73 } |
| 70 | 74 |
| 71 SyncFileSystemBackend::~SyncFileSystemBackend() { | 75 SyncFileSystemBackend::~SyncFileSystemBackend() { |
| 76 RevokeSyncableFileSystem(); |
| 77 |
| 72 if (change_tracker_) { | 78 if (change_tracker_) { |
| 73 GetDelegate()->file_task_runner()->DeleteSoon( | 79 GetDelegate()->file_task_runner()->DeleteSoon( |
| 74 FROM_HERE, change_tracker_.release()); | 80 FROM_HERE, change_tracker_.release()); |
| 75 } | 81 } |
| 76 | 82 |
| 77 if (profile_holder_ && !CalledOnUIThread()) { | 83 if (profile_holder_ && !CalledOnUIThread()) { |
| 78 BrowserThread::DeleteSoon( | 84 BrowserThread::DeleteSoon( |
| 79 BrowserThread::UI, FROM_HERE, profile_holder_.release()); | 85 BrowserThread::UI, FROM_HERE, profile_holder_.release()); |
| 80 } | 86 } |
| 81 } | 87 } |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 callback.Run(GURL(), std::string(), | 287 callback.Run(GURL(), std::string(), |
| 282 SyncStatusCodeToPlatformFileError(status)); | 288 SyncStatusCodeToPlatformFileError(status)); |
| 283 return; | 289 return; |
| 284 } | 290 } |
| 285 | 291 |
| 286 GetDelegate()->OpenFileSystem(origin_url, type, mode, callback, | 292 GetDelegate()->OpenFileSystem(origin_url, type, mode, callback, |
| 287 GetSyncableFileSystemRootURI(origin_url)); | 293 GetSyncableFileSystemRootURI(origin_url)); |
| 288 } | 294 } |
| 289 | 295 |
| 290 } // namespace sync_file_system | 296 } // namespace sync_file_system |
| OLD | NEW |