| 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 "base/threading/sequenced_worker_pool.h" | 8 #include "base/threading/sequenced_worker_pool.h" |
| 9 #include "chrome/browser/drive/drive_api_service.h" | 9 #include "chrome/browser/drive/drive_api_service.h" |
| 10 #include "chrome/browser/drive/drive_notification_manager_factory.h" | 10 #include "chrome/browser/drive/drive_notification_manager_factory.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 SyncFileSystemService* service = new SyncFileSystemService(profile); | 64 SyncFileSystemService* service = new SyncFileSystemService(profile); |
| 65 | 65 |
| 66 scoped_ptr<LocalFileSyncService> local_file_service( | 66 scoped_ptr<LocalFileSyncService> local_file_service( |
| 67 new LocalFileSyncService(profile)); | 67 new LocalFileSyncService(profile)); |
| 68 | 68 |
| 69 scoped_ptr<RemoteFileSyncService> remote_file_service; | 69 scoped_ptr<RemoteFileSyncService> remote_file_service; |
| 70 if (mock_remote_file_service_) { | 70 if (mock_remote_file_service_) { |
| 71 remote_file_service = mock_remote_file_service_.Pass(); | 71 remote_file_service = mock_remote_file_service_.Pass(); |
| 72 } else if (CommandLine::ForCurrentProcess()->HasSwitch( | 72 } else if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 73 kEnableSyncFileSystemV2)) { | 73 kEnableSyncFileSystemV2)) { |
| 74 RegisterSyncableFileSystem(); | |
| 75 | |
| 76 GURL base_drive_url( | 74 GURL base_drive_url( |
| 77 google_apis::DriveApiUrlGenerator::kBaseUrlForProduction); | 75 google_apis::DriveApiUrlGenerator::kBaseUrlForProduction); |
| 78 GURL base_download_url( | 76 GURL base_download_url( |
| 79 google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction); | 77 google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction); |
| 80 GURL wapi_base_url( | 78 GURL wapi_base_url( |
| 81 google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction); | 79 google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction); |
| 82 | 80 |
| 83 scoped_refptr<base::SequencedWorkerPool> worker_pool( | 81 scoped_refptr<base::SequencedWorkerPool> worker_pool( |
| 84 content::BrowserThread::GetBlockingPool()); | 82 content::BrowserThread::GetBlockingPool()); |
| 85 | 83 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 105 new drive_backend::SyncEngine( | 103 new drive_backend::SyncEngine( |
| 106 context->GetPath(), | 104 context->GetPath(), |
| 107 task_runner.get(), | 105 task_runner.get(), |
| 108 drive_api_service.Pass(), | 106 drive_api_service.Pass(), |
| 109 notification_manager, | 107 notification_manager, |
| 110 extension_service)); | 108 extension_service)); |
| 111 | 109 |
| 112 sync_engine->Initialize(); | 110 sync_engine->Initialize(); |
| 113 remote_file_service = sync_engine.PassAs<RemoteFileSyncService>(); | 111 remote_file_service = sync_engine.PassAs<RemoteFileSyncService>(); |
| 114 } else { | 112 } else { |
| 115 // FileSystem needs to be registered before DriveFileSyncService runs | |
| 116 // its initialization code. | |
| 117 RegisterSyncableFileSystem(); | |
| 118 remote_file_service = | 113 remote_file_service = |
| 119 DriveFileSyncService::Create(profile).PassAs<RemoteFileSyncService>(); | 114 DriveFileSyncService::Create(profile).PassAs<RemoteFileSyncService>(); |
| 120 } | 115 } |
| 121 | 116 |
| 122 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) { | 117 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) { |
| 123 remote_file_service->SetConflictResolutionPolicy( | 118 remote_file_service->SetConflictResolutionPolicy( |
| 124 CONFLICT_RESOLUTION_POLICY_MANUAL); | 119 CONFLICT_RESOLUTION_POLICY_MANUAL); |
| 125 } | 120 } |
| 126 | 121 |
| 127 service->Initialize(local_file_service.Pass(), | 122 service->Initialize(local_file_service.Pass(), |
| 128 remote_file_service.Pass()); | 123 remote_file_service.Pass()); |
| 129 return service; | 124 return service; |
| 130 } | 125 } |
| 131 | 126 |
| 132 } // namespace sync_file_system | 127 } // namespace sync_file_system |
| OLD | NEW |