OLD | NEW |
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/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 if (type_ == SIGNIN_TYPE_WITH_CREDENTIALS && | 675 if (type_ == SIGNIN_TYPE_WITH_CREDENTIALS && |
676 !gaia::AreEmailsSame(display_email_iter->second, | 676 !gaia::AreEmailsSame(display_email_iter->second, |
677 possibly_invalid_username_)) { | 677 possibly_invalid_username_)) { |
678 OnGetUserInfoKeyNotFound(kGetInfoDisplayEmailKey); | 678 OnGetUserInfoKeyNotFound(kGetInfoDisplayEmailKey); |
679 return; | 679 return; |
680 } | 680 } |
681 | 681 |
682 possibly_invalid_username_ = email_iter->second; | 682 possibly_invalid_username_ = email_iter->second; |
683 | 683 |
684 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) | 684 #if defined(ENABLE_CONFIGURATION_POLICY) && !defined(OS_CHROMEOS) |
685 // TODO(atwilson): Refactor this to expose an observer interface to allow | 685 // TODO(atwilson): Move this code out to OneClickSignin instead of having |
686 // UserPolicySigninService and OneClickSignin to display UI here, instead | 686 // it embedded in SigninManager - we don't want UI logic in SigninManager. |
687 // of having this logic in SigninManager. | 687 // If this is a new signin (authenticated_username_ is not set) and we have |
688 // If we have an OAuth token, try loading policy for this user now, before | 688 // an OAuth token, try loading policy for this user now, before any signed in |
689 // any signed in services are initialized. If there's no oauth token (the | 689 // services are initialized. If there's no oauth token (the user is using the |
690 // user is using the old ClientLogin flow) then policy will get loaded once | 690 // old ClientLogin flow) then policy will get loaded once the TokenService |
691 // the TokenService finishes initializing (not ideal, but it's a reasonable | 691 // finishes initializing (not ideal, but it's a reasonable fallback). |
692 // fallback). | 692 if (authenticated_username_.empty() && |
693 if (!temp_oauth_login_tokens_.refresh_token.empty()) { | 693 !temp_oauth_login_tokens_.refresh_token.empty()) { |
694 policy::UserPolicySigninService* policy_service = | 694 policy::UserPolicySigninService* policy_service = |
695 policy::UserPolicySigninServiceFactory::GetForProfile(profile_); | 695 policy::UserPolicySigninServiceFactory::GetForProfile(profile_); |
696 policy_service->RegisterPolicyClient( | 696 policy_service->RegisterPolicyClient( |
697 possibly_invalid_username_, | 697 possibly_invalid_username_, |
698 temp_oauth_login_tokens_.refresh_token, | 698 temp_oauth_login_tokens_.refresh_token, |
699 base::Bind(&SigninManager::OnRegisteredForPolicy, | 699 base::Bind(&SigninManager::OnRegisteredForPolicy, |
700 weak_pointer_factory_.GetWeakPtr())); | 700 weak_pointer_factory_.GetWeakPtr())); |
701 return; | 701 return; |
702 } | 702 } |
703 #endif | 703 #endif |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
916 NotifySigninValueChanged(field, value)); | 916 NotifySigninValueChanged(field, value)); |
917 } | 917 } |
918 | 918 |
919 void SigninManager::NotifyDiagnosticsObservers( | 919 void SigninManager::NotifyDiagnosticsObservers( |
920 const TimedSigninStatusField& field, | 920 const TimedSigninStatusField& field, |
921 const std::string& value) { | 921 const std::string& value) { |
922 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, | 922 FOR_EACH_OBSERVER(SigninDiagnosticsObserver, |
923 signin_diagnostics_observers_, | 923 signin_diagnostics_observers_, |
924 NotifySigninValueChanged(field, value)); | 924 NotifySigninValueChanged(field, value)); |
925 } | 925 } |
OLD | NEW |