Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service_factory.cc

Issue 73613003: [SyncFS] Add DriveUploader to SyncEngineContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chrome/browser/drive/drive_uploader.h"
11 #include "chrome/browser/extensions/extension_service.h" 12 #include "chrome/browser/extensions/extension_service.h"
12 #include "chrome/browser/extensions/extension_system_factory.h" 13 #include "chrome/browser/extensions/extension_system_factory.h"
13 #include "chrome/browser/google_apis/drive_api_url_generator.h" 14 #include "chrome/browser/google_apis/drive_api_url_generator.h"
14 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h" 15 #include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
15 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/signin/profile_oauth2_token_service.h" 17 #include "chrome/browser/signin/profile_oauth2_token_service.h"
17 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
18 #include "chrome/browser/sync/profile_sync_service.h" 19 #include "chrome/browser/sync/profile_sync_service.h"
19 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" 20 #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h"
20 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h" 21 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_servi ce.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 kEnableSyncFileSystemV2)) { 75 kEnableSyncFileSystemV2)) {
75 GURL base_drive_url( 76 GURL base_drive_url(
76 google_apis::DriveApiUrlGenerator::kBaseUrlForProduction); 77 google_apis::DriveApiUrlGenerator::kBaseUrlForProduction);
77 GURL base_download_url( 78 GURL base_download_url(
78 google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction); 79 google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction);
79 GURL wapi_base_url( 80 GURL wapi_base_url(
80 google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction); 81 google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction);
81 82
82 scoped_refptr<base::SequencedWorkerPool> worker_pool( 83 scoped_refptr<base::SequencedWorkerPool> worker_pool(
83 content::BrowserThread::GetBlockingPool()); 84 content::BrowserThread::GetBlockingPool());
85 scoped_refptr<base::SequencedTaskRunner> drive_task_runner(
86 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
87 worker_pool->GetSequenceToken(),
88 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
84 89
85 ProfileOAuth2TokenService* token_service = 90 ProfileOAuth2TokenService* token_service =
86 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 91 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
87 scoped_ptr<drive::DriveAPIService> drive_service( 92 scoped_ptr<drive::DriveServiceInterface> drive_service(
88 new drive::DriveAPIService( 93 new drive::DriveAPIService(
89 token_service, 94 token_service,
90 context->GetRequestContext(), 95 context->GetRequestContext(),
91 worker_pool->GetSequencedTaskRunner( 96 drive_task_runner.get(),
92 worker_pool->GetSequenceToken()).get(),
93 base_drive_url, base_download_url, wapi_base_url, 97 base_drive_url, base_download_url, wapi_base_url,
94 std::string() /* custom_user_agent */)); 98 std::string() /* custom_user_agent */));
95 drive_service->Initialize(token_service->GetPrimaryAccountId()); 99 drive_service->Initialize(token_service->GetPrimaryAccountId());
96 100
101 scoped_ptr<drive::DriveUploaderInterface> drive_uploader(
102 new drive::DriveUploader(drive_service.get(), drive_task_runner.get()));
103
97 drive::DriveNotificationManager* notification_manager = 104 drive::DriveNotificationManager* notification_manager =
98 drive::DriveNotificationManagerFactory::GetForBrowserContext(profile); 105 drive::DriveNotificationManagerFactory::GetForBrowserContext(profile);
99 ExtensionService* extension_service = 106 ExtensionService* extension_service =
100 extensions::ExtensionSystem::Get(profile)->extension_service(); 107 extensions::ExtensionSystem::Get(profile)->extension_service();
101 108
102 scoped_refptr<base::SequencedTaskRunner> task_runner( 109 scoped_refptr<base::SequencedTaskRunner> task_runner(
103 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 110 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior(
104 worker_pool->GetSequenceToken(), 111 worker_pool->GetSequenceToken(),
105 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); 112 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
106 113
107 scoped_ptr<drive_backend::SyncEngine> sync_engine( 114 scoped_ptr<drive_backend::SyncEngine> sync_engine(
108 new drive_backend::SyncEngine( 115 new drive_backend::SyncEngine(
109 GetSyncFileSystemDir(context->GetPath()), 116 GetSyncFileSystemDir(context->GetPath()),
110 task_runner.get(), 117 task_runner.get(),
111 drive_service.PassAs<drive::DriveServiceInterface>(), 118 drive_service.Pass(),
119 drive_uploader.Pass(),
112 notification_manager, 120 notification_manager,
113 extension_service)); 121 extension_service));
114 122
115 sync_engine->Initialize(); 123 sync_engine->Initialize();
116 remote_file_service = sync_engine.PassAs<RemoteFileSyncService>(); 124 remote_file_service = sync_engine.PassAs<RemoteFileSyncService>();
117 } else { 125 } else {
118 remote_file_service = 126 remote_file_service =
119 DriveFileSyncService::Create(profile).PassAs<RemoteFileSyncService>(); 127 DriveFileSyncService::Create(profile).PassAs<RemoteFileSyncService>();
120 } 128 }
121 129
122 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) { 130 if (CommandLine::ForCurrentProcess()->HasSwitch(kDisableLastWriteWin)) {
123 remote_file_service->SetConflictResolutionPolicy( 131 remote_file_service->SetConflictResolutionPolicy(
124 CONFLICT_RESOLUTION_POLICY_MANUAL); 132 CONFLICT_RESOLUTION_POLICY_MANUAL);
125 } 133 }
126 134
127 service->Initialize(local_file_service.Pass(), 135 service->Initialize(local_file_service.Pass(),
128 remote_file_service.Pass()); 136 remote_file_service.Pass());
129 return service; 137 return service;
130 } 138 }
131 139
132 } // namespace sync_file_system 140 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_backend/sync_engine_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698