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

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

Issue 110373007: Delay loading the NTP after sign in until MergeSession has been performed in (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years 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/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/prefs/pref_service.h" 11 #include "base/prefs/pref_service.h"
12 #include "base/strings/string_split.h" 12 #include "base/strings/string_split.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "base/time/time.h" 15 #include "base/time/time.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/profiles/profile_io_data.h" 17 #include "chrome/browser/profiles/profile_io_data.h"
18 #include "chrome/browser/signin/about_signin_internals.h" 18 #include "chrome/browser/signin/about_signin_internals.h"
19 #include "chrome/browser/signin/about_signin_internals_factory.h" 19 #include "chrome/browser/signin/about_signin_internals_factory.h"
20 #include "chrome/browser/signin/google_auto_login_helper.h"
20 #include "chrome/browser/signin/local_auth.h" 21 #include "chrome/browser/signin/local_auth.h"
21 #include "chrome/browser/signin/profile_oauth2_token_service.h" 22 #include "chrome/browser/signin/profile_oauth2_token_service.h"
22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 23 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
23 #include "chrome/browser/signin/signin_account_id_helper.h" 24 #include "chrome/browser/signin/signin_account_id_helper.h"
24 #include "chrome/browser/signin/signin_global_error.h" 25 #include "chrome/browser/signin/signin_global_error.h"
25 #include "chrome/browser/signin/signin_internals_util.h" 26 #include "chrome/browser/signin/signin_internals_util.h"
26 #include "chrome/browser/signin/signin_manager_cookie_helper.h" 27 #include "chrome/browser/signin/signin_manager_cookie_helper.h"
27 #include "chrome/browser/signin/signin_manager_delegate.h" 28 #include "chrome/browser/signin/signin_manager_delegate.h"
28 #include "chrome/browser/signin/signin_manager_factory.h" 29 #include "chrome/browser/signin/signin_manager_factory.h"
29 #include "chrome/browser/ui/global_error/global_error_service.h" 30 #include "chrome/browser/ui/global_error/global_error_service.h"
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 DCHECK(!possibly_invalid_username_.empty()); 557 DCHECK(!possibly_invalid_username_.empty());
557 OnSignedIn(possibly_invalid_username_); 558 OnSignedIn(possibly_invalid_username_);
558 559
559 DCHECK(!temp_oauth_login_tokens_.refresh_token.empty()); 560 DCHECK(!temp_oauth_login_tokens_.refresh_token.empty());
560 DCHECK(!GetAuthenticatedUsername().empty()); 561 DCHECK(!GetAuthenticatedUsername().empty());
561 ProfileOAuth2TokenService* token_service = 562 ProfileOAuth2TokenService* token_service =
562 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_); 563 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_);
563 token_service->UpdateCredentials(GetAuthenticatedUsername(), 564 token_service->UpdateCredentials(GetAuthenticatedUsername(),
564 temp_oauth_login_tokens_.refresh_token); 565 temp_oauth_login_tokens_.refresh_token);
565 temp_oauth_login_tokens_ = ClientOAuthResult(); 566 temp_oauth_login_tokens_ = ClientOAuthResult();
567
568 // If inline sign in is enabled, but new profile manage is not, perform a
569 // merge session now to push the user's credentials into the cookie jar.
570 if (!switches::IsNewProfileManagement() && switches::IsEnableInlineSignin()) {
571 // The helper deletes itself when done.
572 GoogleAutoLoginHelper* helper = new GoogleAutoLoginHelper(profile_);
573 helper->LogIn();
574 }
566 } 575 }
567 576
568 void SigninManager::OnExternalSigninCompleted(const std::string& username) { 577 void SigninManager::OnExternalSigninCompleted(const std::string& username) {
569 OnSignedIn(username); 578 OnSignedIn(username);
570 } 579 }
571 580
572 void SigninManager::OnSignedIn(const std::string& username) { 581 void SigninManager::OnSignedIn(const std::string& username) {
573 SetAuthenticatedUsername(username); 582 SetAuthenticatedUsername(username);
574 possibly_invalid_username_.clear(); 583 possibly_invalid_username_.clear();
575 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, 584 profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 } 626 }
618 } 627 }
619 628
620 void SigninManager::ProhibitSignout(bool prohibit_signout) { 629 void SigninManager::ProhibitSignout(bool prohibit_signout) {
621 prohibit_signout_ = prohibit_signout; 630 prohibit_signout_ = prohibit_signout;
622 } 631 }
623 632
624 bool SigninManager::IsSignoutProhibited() const { 633 bool SigninManager::IsSignoutProhibited() const {
625 return prohibit_signout_; 634 return prohibit_signout_;
626 } 635 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698