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

Side by Side Diff: chrome/browser/signin/signin_manager.cc

Issue 19567004: Convert SigninTracker to use OAuth2TokenService notifications (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased 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 | Annotate | Revision Log
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/signin/signin_manager.h" 5 #include "chrome/browser/signin/signin_manager.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 void SigninManager::CompletePendingSignin() { 547 void SigninManager::CompletePendingSignin() {
548 DCHECK(!possibly_invalid_username_.empty()); 548 DCHECK(!possibly_invalid_username_.empty());
549 OnSignedIn(possibly_invalid_username_); 549 OnSignedIn(possibly_invalid_username_);
550 550
551 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 551 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
552 token_service->UpdateCredentials(last_result_); 552 token_service->UpdateCredentials(last_result_);
553 DCHECK(token_service->AreCredentialsValid()); 553 DCHECK(token_service->AreCredentialsValid());
554 token_service->StartFetchingTokens(); 554 token_service->StartFetchingTokens();
555 555
556 // If we have oauth2 tokens, tell token service about them so it does not 556 // If we have oauth2 tokens, tell token service about them so it does not
557 // need to fetch them again. 557 // need to fetch them again. Its important that the authenticated name has
558 // already been set before sending the oauth2 token to the token service.
559 // Some token service listeners will query the authenticated name when they
560 // receive the token available notification.
558 if (!temp_oauth_login_tokens_.refresh_token.empty()) { 561 if (!temp_oauth_login_tokens_.refresh_token.empty()) {
562 DCHECK(!GetAuthenticatedUsername().empty());
559 token_service->UpdateCredentialsWithOAuth2(temp_oauth_login_tokens_); 563 token_service->UpdateCredentialsWithOAuth2(temp_oauth_login_tokens_);
560 temp_oauth_login_tokens_ = ClientOAuthResult(); 564 temp_oauth_login_tokens_ = ClientOAuthResult();
561 } 565 }
562 } 566 }
563 567
564 void SigninManager::OnExternalSigninCompleted(const std::string& username) { 568 void SigninManager::OnExternalSigninCompleted(const std::string& username) {
565 OnSignedIn(username); 569 OnSignedIn(username);
566 } 570 }
567 571
568 void SigninManager::OnSignedIn(const std::string& username) { 572 void SigninManager::OnSignedIn(const std::string& username) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 } 611 }
608 } 612 }
609 613
610 void SigninManager::ProhibitSignout(bool prohibit_signout) { 614 void SigninManager::ProhibitSignout(bool prohibit_signout) {
611 prohibit_signout_ = prohibit_signout; 615 prohibit_signout_ = prohibit_signout;
612 } 616 }
613 617
614 bool SigninManager::IsSignoutProhibited() const { 618 bool SigninManager::IsSignoutProhibited() const {
615 return prohibit_signout_; 619 return prohibit_signout_;
616 } 620 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/fake_profile_oauth2_token_service.cc ('k') | chrome/browser/signin/signin_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698