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

Side by Side Diff: chrome/browser/chromeos/drive/drive_integration_service.cc

Issue 23382008: Making OAuth2TokenService multi-login aware, updating callers, minor fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adding the AndroidPO2TS update Created 7 years, 3 months 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
OLDNEW
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/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 is_initialized_(false), 130 is_initialized_(false),
131 cache_root_directory_(!test_cache_root.empty() ? 131 cache_root_directory_(!test_cache_root.empty() ?
132 test_cache_root : util::GetCacheRootPath(profile)), 132 test_cache_root : util::GetCacheRootPath(profile)),
133 weak_ptr_factory_(this) { 133 weak_ptr_factory_(this) {
134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 134 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
135 135
136 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); 136 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool();
137 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner( 137 blocking_task_runner_ = blocking_pool->GetSequencedTaskRunner(
138 blocking_pool->GetSequenceToken()); 138 blocking_pool->GetSequenceToken());
139 139
140 OAuth2TokenService* oauth_service = 140 ProfileOAuth2TokenService* oauth_service =
141 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 141 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
142 142
143 if (test_drive_service) { 143 if (test_drive_service) {
144 drive_service_.reset(test_drive_service); 144 drive_service_.reset(test_drive_service);
145 } else if (util::IsDriveV2ApiEnabled()) { 145 } else if (util::IsDriveV2ApiEnabled()) {
146 drive_service_.reset(new DriveAPIService( 146 drive_service_.reset(new DriveAPIService(
147 oauth_service, 147 oauth_service,
148 oauth_service->GetPrimaryAccountId(),
148 g_browser_process->system_request_context(), 149 g_browser_process->system_request_context(),
149 blocking_task_runner_.get(), 150 blocking_task_runner_.get(),
150 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), 151 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction),
151 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), 152 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction),
152 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 153 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
153 GetDriveUserAgent())); 154 GetDriveUserAgent()));
154 } else { 155 } else {
155 drive_service_.reset(new GDataWapiService( 156 drive_service_.reset(new GDataWapiService(
156 oauth_service, 157 oauth_service,
158 oauth_service->GetPrimaryAccountId(),
157 g_browser_process->system_request_context(), 159 g_browser_process->system_request_context(),
158 blocking_task_runner_.get(), 160 blocking_task_runner_.get(),
159 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 161 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
160 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), 162 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction),
161 GetDriveUserAgent())); 163 GetDriveUserAgent()));
162 } 164 }
163 scheduler_.reset(new JobScheduler( 165 scheduler_.reset(new JobScheduler(
164 profile_->GetPrefs(), 166 profile_->GetPrefs(),
165 drive_service_.get(), 167 drive_service_.get(),
166 blocking_task_runner_.get())); 168 blocking_task_runner_.get()));
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 profile, NULL, base::FilePath(), NULL); 452 profile, NULL, base::FilePath(), NULL);
451 } else { 453 } else {
452 service = factory_for_test_.Run(profile); 454 service = factory_for_test_.Run(profile);
453 } 455 }
454 456
455 service->Initialize(); 457 service->Initialize();
456 return service; 458 return service;
457 } 459 }
458 460
459 } // namespace drive 461 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698