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() { |
72 if (change_tracker_) { | 76 if (change_tracker_) { |
73 GetDelegate()->file_task_runner()->DeleteSoon( | 77 GetDelegate()->file_task_runner()->DeleteSoon( |
74 FROM_HERE, change_tracker_.release()); | 78 FROM_HERE, change_tracker_.release()); |
75 } | 79 } |
76 | 80 |
77 if (profile_holder_ && !CalledOnUIThread()) { | 81 if (profile_holder_ && !CalledOnUIThread()) { |
78 BrowserThread::DeleteSoon( | 82 BrowserThread::DeleteSoon( |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 callback.Run(GURL(), std::string(), | 285 callback.Run(GURL(), std::string(), |
282 SyncStatusCodeToPlatformFileError(status)); | 286 SyncStatusCodeToPlatformFileError(status)); |
283 return; | 287 return; |
284 } | 288 } |
285 | 289 |
286 GetDelegate()->OpenFileSystem(origin_url, type, mode, callback, | 290 GetDelegate()->OpenFileSystem(origin_url, type, mode, callback, |
287 GetSyncableFileSystemRootURI(origin_url)); | 291 GetSyncableFileSystemRootURI(origin_url)); |
288 } | 292 } |
289 | 293 |
290 } // namespace sync_file_system | 294 } // namespace sync_file_system |
OLD | NEW |