| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" | 11 #include "chrome/browser/sync_file_system/local/local_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 "chrome/browser/sync_file_system/syncable_file_system_util.h" | 13 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 14 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 15 | 15 |
| 16 namespace sync_file_system { | 16 namespace sync_file_system { |
| 17 | 17 |
| 18 namespace { | |
| 19 const char kDisableLastWriteWin[] = "disable-syncfs-last-write-win"; | |
| 20 } | |
| 21 | |
| 22 // static | 18 // static |
| 23 SyncFileSystemService* SyncFileSystemServiceFactory::GetForProfile( | 19 SyncFileSystemService* SyncFileSystemServiceFactory::GetForProfile( |
| 24 Profile* profile) { | 20 Profile* profile) { |
| 25 return static_cast<SyncFileSystemService*>( | 21 return static_cast<SyncFileSystemService*>( |
| 26 GetInstance()->GetServiceForBrowserContext(profile, true)); | 22 GetInstance()->GetServiceForBrowserContext(profile, true)); |
| 27 } | 23 } |
| 28 | 24 |
| 29 // static | 25 // static |
| 30 SyncFileSystemServiceFactory* SyncFileSystemServiceFactory::GetInstance() { | 26 SyncFileSystemServiceFactory* SyncFileSystemServiceFactory::GetInstance() { |
| 31 return Singleton<SyncFileSystemServiceFactory>::get(); | 27 return Singleton<SyncFileSystemServiceFactory>::get(); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 if (mock_remote_file_service_) { | 64 if (mock_remote_file_service_) { |
| 69 remote_file_service = mock_remote_file_service_.Pass(); | 65 remote_file_service = mock_remote_file_service_.Pass(); |
| 70 } else if (IsV2Enabled()) { | 66 } else if (IsV2Enabled()) { |
| 71 remote_file_service = RemoteFileSyncService::CreateForBrowserContext( | 67 remote_file_service = RemoteFileSyncService::CreateForBrowserContext( |
| 72 RemoteFileSyncService::V2, context); | 68 RemoteFileSyncService::V2, context); |
| 73 } else { | 69 } else { |
| 74 remote_file_service = RemoteFileSyncService::CreateForBrowserContext( | 70 remote_file_service = RemoteFileSyncService::CreateForBrowserContext( |
| 75 RemoteFileSyncService::V1, context); | 71 RemoteFileSyncService::V1, context); |
| 76 } | 72 } |
| 77 | 73 |
| 78 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) { | |
| 79 remote_file_service->SetDefaultConflictResolutionPolicy( | |
| 80 CONFLICT_RESOLUTION_POLICY_MANUAL); | |
| 81 } | |
| 82 | |
| 83 service->Initialize(local_file_service.Pass(), | 74 service->Initialize(local_file_service.Pass(), |
| 84 remote_file_service.Pass()); | 75 remote_file_service.Pass()); |
| 85 return service; | 76 return service; |
| 86 } | 77 } |
| 87 | 78 |
| 88 } // namespace sync_file_system | 79 } // namespace sync_file_system |
| OLD | NEW |