OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/sync_file_system_service_factory.h" | 5 #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/google_apis/drive_notification_manager_factory.h" | 8 #include "chrome/browser/google_apis/drive_notification_manager_factory.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sync/profile_sync_service.h" | 10 #include "chrome/browser/sync/profile_sync_service.h" |
11 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" | 11 #include "chrome/browser/sync_file_system/drive_file_sync_service.h" |
12 #include "chrome/browser/sync_file_system/sync_file_system_service.h" | 12 #include "chrome/browser/sync_file_system/sync_file_system_service.h" |
13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 13 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
14 #include "webkit/fileapi/syncable/syncable_file_system_util.h" | 14 #include "webkit/fileapi/syncable/syncable_file_system_util.h" |
15 | 15 |
16 namespace sync_file_system { | 16 namespace sync_file_system { |
17 | 17 |
18 namespace { | 18 namespace { |
19 const char kDisableLastWriteWin[] = "disable-syncfs-last-write-win"; | 19 const char kDisableLastWriteWin[] = "disable-syncfs-last-write-win"; |
20 } | 20 } |
21 | 21 |
22 // static | 22 // static |
23 SyncFileSystemService* SyncFileSystemServiceFactory::GetForProfile( | 23 SyncFileSystemService* SyncFileSystemServiceFactory::GetForProfile( |
24 Profile* profile) { | 24 Profile* profile) { |
25 return static_cast<SyncFileSystemService*>( | 25 return static_cast<SyncFileSystemService*>( |
26 GetInstance()->GetServiceForProfile(profile, true)); | 26 GetInstance()->GetServiceForBrowserContext(profile, true)); |
27 } | 27 } |
28 | 28 |
29 // static | 29 // static |
30 SyncFileSystemServiceFactory* SyncFileSystemServiceFactory::GetInstance() { | 30 SyncFileSystemServiceFactory* SyncFileSystemServiceFactory::GetInstance() { |
31 return Singleton<SyncFileSystemServiceFactory>::get(); | 31 return Singleton<SyncFileSystemServiceFactory>::get(); |
32 } | 32 } |
33 | 33 |
34 void SyncFileSystemServiceFactory::set_mock_remote_file_service( | 34 void SyncFileSystemServiceFactory::set_mock_remote_file_service( |
35 scoped_ptr<RemoteFileSyncService> mock_remote_service) { | 35 scoped_ptr<RemoteFileSyncService> mock_remote_service) { |
36 mock_remote_file_service_ = mock_remote_service.Pass(); | 36 mock_remote_file_service_ = mock_remote_service.Pass(); |
37 } | 37 } |
38 | 38 |
39 SyncFileSystemServiceFactory::SyncFileSystemServiceFactory() | 39 SyncFileSystemServiceFactory::SyncFileSystemServiceFactory() |
40 : ProfileKeyedServiceFactory("SyncFileSystemService", | 40 : BrowserContextKeyedServiceFactory( |
41 ProfileDependencyManager::GetInstance()) { | 41 "SyncFileSystemService", |
| 42 BrowserContextDependencyManager::GetInstance()) { |
42 DependsOn(google_apis::DriveNotificationManagerFactory::GetInstance()); | 43 DependsOn(google_apis::DriveNotificationManagerFactory::GetInstance()); |
43 } | 44 } |
44 | 45 |
45 SyncFileSystemServiceFactory::~SyncFileSystemServiceFactory() {} | 46 SyncFileSystemServiceFactory::~SyncFileSystemServiceFactory() {} |
46 | 47 |
47 ProfileKeyedService* SyncFileSystemServiceFactory::BuildServiceInstanceFor( | 48 BrowserContextKeyedService* |
| 49 SyncFileSystemServiceFactory::BuildServiceInstanceFor( |
48 content::BrowserContext* context) const { | 50 content::BrowserContext* context) const { |
49 Profile* profile = static_cast<Profile*>(context); | 51 Profile* profile = static_cast<Profile*>(context); |
50 | 52 |
51 SyncFileSystemService* service = new SyncFileSystemService(profile); | 53 SyncFileSystemService* service = new SyncFileSystemService(profile); |
52 | 54 |
53 scoped_ptr<LocalFileSyncService> local_file_service( | 55 scoped_ptr<LocalFileSyncService> local_file_service( |
54 new LocalFileSyncService(profile)); | 56 new LocalFileSyncService(profile)); |
55 | 57 |
56 scoped_ptr<RemoteFileSyncService> remote_file_service; | 58 scoped_ptr<RemoteFileSyncService> remote_file_service; |
57 if (mock_remote_file_service_) { | 59 if (mock_remote_file_service_) { |
(...skipping 10 matching lines...) Expand all Loading... |
68 remote_file_service->SetConflictResolutionPolicy( | 70 remote_file_service->SetConflictResolutionPolicy( |
69 CONFLICT_RESOLUTION_MANUAL); | 71 CONFLICT_RESOLUTION_MANUAL); |
70 } | 72 } |
71 | 73 |
72 service->Initialize(local_file_service.Pass(), | 74 service->Initialize(local_file_service.Pass(), |
73 remote_file_service.Pass()); | 75 remote_file_service.Pass()); |
74 return service; | 76 return service; |
75 } | 77 } |
76 | 78 |
77 } // namespace sync_file_system | 79 } // namespace sync_file_system |
OLD | NEW |