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

Side by Side Diff: chrome/browser/drive/drive_api_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: Rebasing to include the update to ProfileSyncService: r224220 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/drive/drive_api_service.h" 5 #include "chrome/browser/drive/drive_api_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 custom_user_agent_(custom_user_agent) { 264 custom_user_agent_(custom_user_agent) {
265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 265 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
266 } 266 }
267 267
268 DriveAPIService::~DriveAPIService() { 268 DriveAPIService::~DriveAPIService() {
269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 269 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
270 if (sender_.get()) 270 if (sender_.get())
271 sender_->auth_service()->RemoveObserver(this); 271 sender_->auth_service()->RemoveObserver(this);
272 } 272 }
273 273
274 void DriveAPIService::Initialize() { 274 void DriveAPIService::Initialize(const std::string& account_id) {
275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 275 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
276 276
277 std::vector<std::string> scopes; 277 std::vector<std::string> scopes;
278 scopes.push_back(kDriveScope); 278 scopes.push_back(kDriveScope);
279 scopes.push_back(kDriveAppsReadonlyScope); 279 scopes.push_back(kDriveAppsReadonlyScope);
280 280
281 // GData WAPI token. These are for GetShareUrl(). 281 // GData WAPI token. These are for GetShareUrl().
282 scopes.push_back(util::kDocsListScope); 282 scopes.push_back(util::kDocsListScope);
283 scopes.push_back(util::kDriveAppsScope); 283 scopes.push_back(util::kDriveAppsScope);
284 284
285 sender_.reset(new RequestSender( 285 sender_.reset(new RequestSender(
286 new google_apis::AuthService( 286 new google_apis::AuthService(oauth2_token_service_,
287 oauth2_token_service_, url_request_context_getter_, scopes), 287 account_id,
288 url_request_context_getter_, 288 url_request_context_getter_,
289 blocking_task_runner_.get(), 289 scopes),
290 custom_user_agent_)); 290 url_request_context_getter_,
291 blocking_task_runner_.get(),
292 custom_user_agent_));
291 sender_->auth_service()->AddObserver(this); 293 sender_->auth_service()->AddObserver(this);
292 } 294 }
293 295
294 void DriveAPIService::AddObserver(DriveServiceObserver* observer) { 296 void DriveAPIService::AddObserver(DriveServiceObserver* observer) {
295 observers_.AddObserver(observer); 297 observers_.AddObserver(observer);
296 } 298 }
297 299
298 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) { 300 void DriveAPIService::RemoveObserver(DriveServiceObserver* observer) {
299 observers_.RemoveObserver(observer); 301 observers_.RemoveObserver(observer);
300 } 302 }
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 if (CanSendRequest()) { 831 if (CanSendRequest()) {
830 FOR_EACH_OBSERVER( 832 FOR_EACH_OBSERVER(
831 DriveServiceObserver, observers_, OnReadyToSendRequests()); 833 DriveServiceObserver, observers_, OnReadyToSendRequests());
832 } else if (!HasRefreshToken()) { 834 } else if (!HasRefreshToken()) {
833 FOR_EACH_OBSERVER( 835 FOR_EACH_OBSERVER(
834 DriveServiceObserver, observers_, OnRefreshTokenInvalid()); 836 DriveServiceObserver, observers_, OnRefreshTokenInvalid());
835 } 837 }
836 } 838 }
837 839
838 } // namespace drive 840 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/drive_api_service.h ('k') | chrome/browser/drive/drive_service_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698