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_change_registrar.h" | 9 #include "base/prefs/pref_change_registrar.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/chromeos/profiles/profile_util.h" | 23 #include "chrome/browser/chromeos/profiles/profile_util.h" |
24 #include "chrome/browser/download/download_prefs.h" | 24 #include "chrome/browser/download/download_prefs.h" |
25 #include "chrome/browser/download/download_service.h" | 25 #include "chrome/browser/download/download_service.h" |
26 #include "chrome/browser/download/download_service_factory.h" | 26 #include "chrome/browser/download/download_service_factory.h" |
27 #include "chrome/browser/drive/drive_api_service.h" | 27 #include "chrome/browser/drive/drive_api_service.h" |
28 #include "chrome/browser/drive/drive_api_util.h" | 28 #include "chrome/browser/drive/drive_api_util.h" |
29 #include "chrome/browser/drive/drive_app_registry.h" | 29 #include "chrome/browser/drive/drive_app_registry.h" |
30 #include "chrome/browser/drive/drive_notification_manager.h" | 30 #include "chrome/browser/drive/drive_notification_manager.h" |
31 #include "chrome/browser/drive/drive_notification_manager_factory.h" | 31 #include "chrome/browser/drive/drive_notification_manager_factory.h" |
32 #include "chrome/browser/drive/event_logger.h" | 32 #include "chrome/browser/drive/event_logger.h" |
33 #include "chrome/browser/drive/gdata_wapi_service.h" | |
34 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
35 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 34 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
36 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 35 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
37 #include "chrome/browser/signin/signin_manager.h" | 36 #include "chrome/browser/signin/signin_manager.h" |
38 #include "chrome/browser/signin/signin_manager_factory.h" | 37 #include "chrome/browser/signin/signin_manager_factory.h" |
39 #include "chrome/common/chrome_version_info.h" | 38 #include "chrome/common/chrome_version_info.h" |
40 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
41 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" | 40 #include "components/browser_context_keyed_service/browser_context_dependency_ma
nager.h" |
42 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
43 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 logger_.reset(new EventLogger); | 221 logger_.reset(new EventLogger); |
223 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); | 222 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); |
224 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( | 223 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( |
225 blocking_pool->GetSequenceToken()); | 224 blocking_pool->GetSequenceToken()); |
226 | 225 |
227 ProfileOAuth2TokenService* oauth_service = | 226 ProfileOAuth2TokenService* oauth_service = |
228 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); | 227 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); |
229 | 228 |
230 if (test_drive_service) { | 229 if (test_drive_service) { |
231 drive_service_.reset(test_drive_service); | 230 drive_service_.reset(test_drive_service); |
232 } else if (util::IsDriveV2ApiEnabled()) { | 231 } else { |
233 drive_service_.reset(new DriveAPIService( | 232 drive_service_.reset(new DriveAPIService( |
234 oauth_service, | 233 oauth_service, |
235 g_browser_process->system_request_context(), | 234 g_browser_process->system_request_context(), |
236 blocking_task_runner_.get(), | 235 blocking_task_runner_.get(), |
237 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), | 236 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), |
238 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), | 237 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), |
239 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | 238 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), |
240 GetDriveUserAgent())); | 239 GetDriveUserAgent())); |
241 } else { | |
242 drive_service_.reset(new GDataWapiService( | |
243 oauth_service, | |
244 g_browser_process->system_request_context(), | |
245 blocking_task_runner_.get(), | |
246 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), | |
247 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), | |
248 GetDriveUserAgent())); | |
249 } | 240 } |
250 scheduler_.reset(new JobScheduler( | 241 scheduler_.reset(new JobScheduler( |
251 profile_->GetPrefs(), | 242 profile_->GetPrefs(), |
252 logger_.get(), | 243 logger_.get(), |
253 drive_service_.get(), | 244 drive_service_.get(), |
254 blocking_task_runner_.get())); | 245 blocking_task_runner_.get())); |
255 metadata_storage_.reset(new internal::ResourceMetadataStorage( | 246 metadata_storage_.reset(new internal::ResourceMetadataStorage( |
256 cache_root_directory_.Append(kMetadataDirectory), | 247 cache_root_directory_.Append(kMetadataDirectory), |
257 blocking_task_runner_.get())); | 248 blocking_task_runner_.get())); |
258 cache_.reset(new internal::FileCache( | 249 cache_.reset(new internal::FileCache( |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 profile, preference_watcher, | 622 profile, preference_watcher, |
632 NULL, std::string(), base::FilePath(), NULL); | 623 NULL, std::string(), base::FilePath(), NULL); |
633 } else { | 624 } else { |
634 service = factory_for_test_->Run(profile); | 625 service = factory_for_test_->Run(profile); |
635 } | 626 } |
636 | 627 |
637 return service; | 628 return service; |
638 } | 629 } |
639 | 630 |
640 } // namespace drive | 631 } // namespace drive |
OLD | NEW |