OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/drive/drive_integration_service.h" | 5 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 | 150 |
151 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); | 151 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); |
152 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( | 152 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( |
153 blocking_pool->GetSequenceToken()); | 153 blocking_pool->GetSequenceToken()); |
154 | 154 |
155 if (test_drive_service) { | 155 if (test_drive_service) { |
156 drive_service_.reset(test_drive_service); | 156 drive_service_.reset(test_drive_service); |
157 } else if (util::IsDriveV2ApiEnabled()) { | 157 } else if (util::IsDriveV2ApiEnabled()) { |
158 drive_service_.reset(new DriveAPIService( | 158 drive_service_.reset(new DriveAPIService( |
159 g_browser_process->system_request_context(), | 159 g_browser_process->system_request_context(), |
160 blocking_task_runner_, | 160 blocking_task_runner_.get(), |
161 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), | 161 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), |
162 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), | 162 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), |
163 GetDriveUserAgent())); | 163 GetDriveUserAgent())); |
164 } else { | 164 } else { |
165 drive_service_.reset(new GDataWapiService( | 165 drive_service_.reset(new GDataWapiService( |
166 g_browser_process->system_request_context(), | 166 g_browser_process->system_request_context(), |
167 blocking_task_runner_, | 167 blocking_task_runner_.get(), |
168 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | 168 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), |
169 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), | 169 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), |
170 GetDriveUserAgent())); | 170 GetDriveUserAgent())); |
171 } | 171 } |
172 scheduler_.reset(new JobScheduler( | 172 scheduler_.reset(new JobScheduler( |
173 profile_, drive_service_.get(), blocking_task_runner_.get())); | 173 profile_, drive_service_.get(), blocking_task_runner_.get())); |
174 metadata_storage_.reset(new internal::ResourceMetadataStorage( | 174 metadata_storage_.reset(new internal::ResourceMetadataStorage( |
175 cache_root_directory_.Append(util::kMetadataDirectory), | 175 cache_root_directory_.Append(util::kMetadataDirectory), |
176 blocking_task_runner_.get())); | 176 blocking_task_runner_.get())); |
177 cache_.reset(new internal::FileCache( | 177 cache_.reset(new internal::FileCache( |
(...skipping 25 matching lines...) Expand all Loading... |
203 DriveIntegrationService::~DriveIntegrationService() { | 203 DriveIntegrationService::~DriveIntegrationService() { |
204 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 204 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
205 } | 205 } |
206 | 206 |
207 void DriveIntegrationService::Initialize() { | 207 void DriveIntegrationService::Initialize() { |
208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
209 drive_service_->Initialize(profile_); | 209 drive_service_->Initialize(profile_); |
210 file_system_->Initialize(); | 210 file_system_->Initialize(); |
211 | 211 |
212 base::PostTaskAndReplyWithResult( | 212 base::PostTaskAndReplyWithResult( |
213 blocking_task_runner_, | 213 blocking_task_runner_.get(), |
214 FROM_HERE, | 214 FROM_HERE, |
215 base::Bind(&InitializeMetadata, | 215 base::Bind(&InitializeMetadata, |
216 cache_root_directory_, | 216 cache_root_directory_, |
217 metadata_storage_.get(), | 217 metadata_storage_.get(), |
218 cache_.get(), | 218 cache_.get(), |
219 resource_metadata_.get()), | 219 resource_metadata_.get()), |
220 base::Bind(&DriveIntegrationService::InitializeAfterMetadataInitialized, | 220 base::Bind(&DriveIntegrationService::InitializeAfterMetadataInitialized, |
221 weak_ptr_factory_.GetWeakPtr())); | 221 weak_ptr_factory_.GetWeakPtr())); |
222 } | 222 } |
223 | 223 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 profile, NULL, base::FilePath(), NULL); | 472 profile, NULL, base::FilePath(), NULL); |
473 } else { | 473 } else { |
474 service = factory_for_test_.Run(profile); | 474 service = factory_for_test_.Run(profile); |
475 } | 475 } |
476 | 476 |
477 service->Initialize(); | 477 service->Initialize(); |
478 return service; | 478 return service; |
479 } | 479 } |
480 | 480 |
481 } // namespace drive | 481 } // namespace drive |
OLD | NEW |