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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend/api_util.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: Fixing a unit test, addressing comments from courage@ 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/drive_backend/api_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend/api_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <sstream> 9 #include <sstream>
10 #include <string> 10 #include <string>
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 : wapi_url_generator_( 161 : wapi_url_generator_(
162 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 162 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
163 GURL(google_apis::GDataWapiUrlGenerator:: 163 GURL(google_apis::GDataWapiUrlGenerator::
164 kBaseDownloadUrlForProduction)), 164 kBaseDownloadUrlForProduction)),
165 drive_api_url_generator_( 165 drive_api_url_generator_(
166 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), 166 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction),
167 GURL(google_apis::DriveApiUrlGenerator:: 167 GURL(google_apis::DriveApiUrlGenerator::
168 kBaseDownloadUrlForProduction)), 168 kBaseDownloadUrlForProduction)),
169 upload_next_key_(0), 169 upload_next_key_(0),
170 temp_dir_path_(temp_dir_path) { 170 temp_dir_path_(temp_dir_path) {
171 OAuth2TokenService* oauth_service = 171 ProfileOAuth2TokenService* oauth_service =
172 ProfileOAuth2TokenServiceFactory::GetForProfile(profile); 172 ProfileOAuth2TokenServiceFactory::GetForProfile(profile);
173 if (IsDriveAPIDisabled()) { 173 if (IsDriveAPIDisabled()) {
174 drive_service_.reset(new drive::GDataWapiService( 174 drive_service_.reset(new drive::GDataWapiService(
175 oauth_service, 175 oauth_service,
176 oauth_service->GetPrimaryAccountId(),
176 profile->GetRequestContext(), 177 profile->GetRequestContext(),
177 content::BrowserThread::GetBlockingPool(), 178 content::BrowserThread::GetBlockingPool(),
178 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 179 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
179 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction), 180 GURL(google_apis::GDataWapiUrlGenerator::kBaseDownloadUrlForProduction),
180 std::string() /* custom_user_agent */)); 181 std::string() /* custom_user_agent */));
181 } else { 182 } else {
182 drive_service_.reset(new drive::DriveAPIService( 183 drive_service_.reset(new drive::DriveAPIService(
183 oauth_service, 184 oauth_service,
185 oauth_service->GetPrimaryAccountId(),
184 profile->GetRequestContext(), 186 profile->GetRequestContext(),
185 content::BrowserThread::GetBlockingPool(), 187 content::BrowserThread::GetBlockingPool(),
186 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction), 188 GURL(google_apis::DriveApiUrlGenerator::kBaseUrlForProduction),
187 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction), 189 GURL(google_apis::DriveApiUrlGenerator::kBaseDownloadUrlForProduction),
188 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction), 190 GURL(google_apis::GDataWapiUrlGenerator::kBaseUrlForProduction),
189 std::string() /* custom_user_agent */)); 191 std::string() /* custom_user_agent */));
190 } 192 }
191 193
192 drive_service_->Initialize(); 194 drive_service_->Initialize();
193 drive_service_->AddObserver(this); 195 drive_service_->AddObserver(this);
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 } 1140 }
1139 1141
1140 std::string APIUtil::GetRootResourceId() const { 1142 std::string APIUtil::GetRootResourceId() const {
1141 if (IsDriveAPIDisabled()) 1143 if (IsDriveAPIDisabled())
1142 return drive_service_->GetRootResourceId(); 1144 return drive_service_->GetRootResourceId();
1143 return root_resource_id_; 1145 return root_resource_id_;
1144 } 1146 }
1145 1147
1146 } // namespace drive_backend 1148 } // namespace drive_backend
1147 } // namespace sync_file_system 1149 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698