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

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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 void SigninManager::CompletePendingSignin() { 586 void SigninManager::CompletePendingSignin() {
587 DCHECK(!possibly_invalid_username_.empty()); 587 DCHECK(!possibly_invalid_username_.empty());
588 OnSignedIn(possibly_invalid_username_); 588 OnSignedIn(possibly_invalid_username_);
589 589
590 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_); 590 TokenService* token_service = TokenServiceFactory::GetForProfile(profile_);
591 token_service->UpdateCredentials(last_result_); 591 token_service->UpdateCredentials(last_result_);
592 DCHECK(token_service->AreCredentialsValid()); 592 DCHECK(token_service->AreCredentialsValid());
593 token_service->StartFetchingTokens(); 593 token_service->StartFetchingTokens();
594 594
595 // If we have oauth2 tokens, tell token service about them so it does not 595 // If we have oauth2 tokens, tell token service about them so it does not
596 // need to fetch them again. 596 // need to fetch them again. Its important that the authenticated name has
597 // already been set before sending the oauth2 token to the token service.
598 // Some token service listeners will query the authenticated name when they
599 // receive the token available notification.
597 if (!temp_oauth_login_tokens_.refresh_token.empty()) { 600 if (!temp_oauth_login_tokens_.refresh_token.empty()) {
601 DCHECK(!GetAuthenticatedUsername().empty());
598 token_service->UpdateCredentialsWithOAuth2(temp_oauth_login_tokens_); 602 token_service->UpdateCredentialsWithOAuth2(temp_oauth_login_tokens_);
599 temp_oauth_login_tokens_ = ClientOAuthResult(); 603 temp_oauth_login_tokens_ = ClientOAuthResult();
600 } 604 }
601 } 605 }
602 606
603 void SigninManager::OnExternalSigninCompleted(const std::string& username) { 607 void SigninManager::OnExternalSigninCompleted(const std::string& username) {
604 OnSignedIn(username); 608 OnSignedIn(username);
605 } 609 }
606 610
607 void SigninManager::OnSignedIn(const std::string& username) { 611 void SigninManager::OnSignedIn(const std::string& username) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 } 650 }
647 } 651 }
648 652
649 void SigninManager::ProhibitSignout(bool prohibit_signout) { 653 void SigninManager::ProhibitSignout(bool prohibit_signout) {
650 prohibit_signout_ = prohibit_signout; 654 prohibit_signout_ = prohibit_signout;
651 } 655 }
652 656
653 bool SigninManager::IsSignoutProhibited() const { 657 bool SigninManager::IsSignoutProhibited() const {
654 return prohibit_signout_; 658 return prohibit_signout_;
655 } 659 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698