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

Side by Side Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 23678007: OAuth2LoginManager+MergeSessionThrottle hardening, multi-profle support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/chromeos/login/login_utils.h" 5 #include "chrome/browser/chromeos/login/login_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/chromeos/chromeos_version.h" 10 #include "base/chromeos/chromeos_version.h"
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/about_flags.h" 30 #include "chrome/browser/about_flags.h"
31 #include "chrome/browser/app_mode/app_mode_utils.h" 31 #include "chrome/browser/app_mode/app_mode_utils.h"
32 #include "chrome/browser/browser_process.h" 32 #include "chrome/browser/browser_process.h"
33 #include "chrome/browser/browser_shutdown.h" 33 #include "chrome/browser/browser_shutdown.h"
34 #include "chrome/browser/chrome_notification_types.h" 34 #include "chrome/browser/chrome_notification_types.h"
35 #include "chrome/browser/chromeos/boot_times_loader.h" 35 #include "chrome/browser/chromeos/boot_times_loader.h"
36 #include "chrome/browser/chromeos/input_method/input_method_util.h" 36 #include "chrome/browser/chromeos/input_method/input_method_util.h"
37 #include "chrome/browser/chromeos/login/chrome_restart_request.h" 37 #include "chrome/browser/chromeos/login/chrome_restart_request.h"
38 #include "chrome/browser/chromeos/login/language_switch_menu.h" 38 #include "chrome/browser/chromeos/login/language_switch_menu.h"
39 #include "chrome/browser/chromeos/login/login_display_host.h" 39 #include "chrome/browser/chromeos/login/login_display_host.h"
40 #include "chrome/browser/chromeos/login/oauth_login_manager.h" 40 #include "chrome/browser/chromeos/login/oauth2_login_manager.h"
41 #include "chrome/browser/chromeos/login/oauth2_login_manager_factory.h"
41 #include "chrome/browser/chromeos/login/parallel_authenticator.h" 42 #include "chrome/browser/chromeos/login/parallel_authenticator.h"
42 #include "chrome/browser/chromeos/login/profile_auth_data.h" 43 #include "chrome/browser/chromeos/login/profile_auth_data.h"
43 #include "chrome/browser/chromeos/login/screen_locker.h" 44 #include "chrome/browser/chromeos/login/screen_locker.h"
44 #include "chrome/browser/chromeos/login/user_manager.h" 45 #include "chrome/browser/chromeos/login/user_manager.h"
45 #include "chrome/browser/chromeos/settings/cros_settings.h" 46 #include "chrome/browser/chromeos/settings/cros_settings.h"
46 #include "chrome/browser/chromeos/settings/cros_settings_names.h" 47 #include "chrome/browser/chromeos/settings/cros_settings_names.h"
47 #include "chrome/browser/extensions/extension_service.h" 48 #include "chrome/browser/extensions/extension_service.h"
48 #include "chrome/browser/first_run/first_run.h" 49 #include "chrome/browser/first_run/first_run.h"
49 #include "chrome/browser/google/google_util_chromeos.h" 50 #include "chrome/browser/google/google_util_chromeos.h"
50 #include "chrome/browser/lifetime/application_lifetime.h" 51 #include "chrome/browser/lifetime/application_lifetime.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 base::FilePath GetRlzDisabledFlagPath() { 91 base::FilePath GetRlzDisabledFlagPath() {
91 return file_util::GetHomeDir().Append(kRLZDisabledFlagName); 92 return file_util::GetHomeDir().Append(kRLZDisabledFlagName);
92 } 93 }
93 #endif 94 #endif
94 95
95 } // namespace 96 } // namespace
96 97
97 class LoginUtilsImpl 98 class LoginUtilsImpl
98 : public LoginUtils, 99 : public LoginUtils,
99 public OAuthLoginManager::Delegate, 100 public OAuth2LoginManager::Observer,
100 public net::NetworkChangeNotifier::ConnectionTypeObserver, 101 public net::NetworkChangeNotifier::ConnectionTypeObserver,
101 public base::SupportsWeakPtr<LoginUtilsImpl> { 102 public base::SupportsWeakPtr<LoginUtilsImpl> {
102 public: 103 public:
103 LoginUtilsImpl() 104 LoginUtilsImpl()
104 : using_oauth_(false), 105 : using_oauth_(false),
106 should_finalize_profile_(false),
105 has_web_auth_cookies_(false), 107 has_web_auth_cookies_(false),
106 login_manager_(OAuthLoginManager::Create(this)),
107 delegate_(NULL), 108 delegate_(NULL),
108 should_restore_auth_session_(false), 109 should_restore_auth_session_(false),
109 session_restore_strategy_( 110 session_restore_strategy_(
110 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN) { 111 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN) {
111 net::NetworkChangeNotifier::AddConnectionTypeObserver(this); 112 net::NetworkChangeNotifier::AddConnectionTypeObserver(this);
112 } 113 }
113 114
114 virtual ~LoginUtilsImpl() { 115 virtual ~LoginUtilsImpl() {
115 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this); 116 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(this);
116 } 117 }
117 118
118 // LoginUtils implementation: 119 // LoginUtils implementation:
119 virtual void DoBrowserLaunch(Profile* profile, 120 virtual void DoBrowserLaunch(Profile* profile,
120 LoginDisplayHost* login_host) OVERRIDE; 121 LoginDisplayHost* login_host) OVERRIDE;
121 virtual void PrepareProfile( 122 virtual void PrepareProfile(
122 const UserContext& user_context, 123 const UserContext& user_context,
123 const std::string& display_email, 124 const std::string& display_email,
124 bool using_oauth, 125 bool using_oauth,
125 bool has_cookies, 126 bool has_cookies,
126 bool has_active_session, 127 bool has_active_session,
127 LoginUtils::Delegate* delegate) OVERRIDE; 128 LoginUtils::Delegate* delegate) OVERRIDE;
128 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE; 129 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) OVERRIDE;
129 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE; 130 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE;
130 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE; 131 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE;
131 virtual scoped_refptr<Authenticator> CreateAuthenticator( 132 virtual scoped_refptr<Authenticator> CreateAuthenticator(
132 LoginStatusConsumer* consumer) OVERRIDE; 133 LoginStatusConsumer* consumer) OVERRIDE;
133 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE; 134 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE;
134 virtual void StopBackgroundFetchers() OVERRIDE;
135 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE; 135 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE;
136 136
137 // OAuthLoginManager::Delegate overrides. 137 // OAuth2LoginManager::Delegate overrides.
138 virtual void OnCompletedMergeSession() OVERRIDE; 138 virtual void OnStartMergeSession(Profile* user_profile) OVERRIDE;
139 virtual void OnCompletedMergeSession(Profile* user_profile) OVERRIDE;
139 virtual void OnCompletedAuthentication(Profile* user_profile) OVERRIDE; 140 virtual void OnCompletedAuthentication(Profile* user_profile) OVERRIDE;
140 virtual void OnFoundStoredTokens() OVERRIDE;
141 141
142 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides. 142 // net::NetworkChangeNotifier::ConnectionTypeObserver overrides.
143 virtual void OnConnectionTypeChanged( 143 virtual void OnConnectionTypeChanged(
144 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; 144 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
145 145
146 private: 146 private:
147 // Restarts OAuth session authentication check. 147 // Restarts OAuth session authentication check.
148 void KickStartAuthentication(Profile* profile); 148 void KickStartAuthentication(Profile* profile);
149 149
150 // Check user's profile for kApplicationLocale setting. 150 // Check user's profile for kApplicationLocale setting.
(...skipping 29 matching lines...) Expand all
180 bool restore_from_auth_cookies); 180 bool restore_from_auth_cookies);
181 181
182 // Initializes RLZ. If |disabled| is true, RLZ pings are disabled. 182 // Initializes RLZ. If |disabled| is true, RLZ pings are disabled.
183 void InitRlz(Profile* user_profile, bool disabled); 183 void InitRlz(Profile* user_profile, bool disabled);
184 184
185 // Starts signing related services. Initiates TokenService token retrieval. 185 // Starts signing related services. Initiates TokenService token retrieval.
186 void StartSignedInServices(Profile* profile); 186 void StartSignedInServices(Profile* profile);
187 187
188 UserContext user_context_; 188 UserContext user_context_;
189 bool using_oauth_; 189 bool using_oauth_;
190 bool should_finalize_profile_;
191
190 // True if the authentication profile's cookie jar should contain 192 // True if the authentication profile's cookie jar should contain
191 // authentication cookies from the authentication extension log in flow. 193 // authentication cookies from the authentication extension log in flow.
192 bool has_web_auth_cookies_; 194 bool has_web_auth_cookies_;
193 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). 195 // Has to be scoped_refptr, see comment for CreateAuthenticator(...).
194 scoped_refptr<Authenticator> authenticator_; 196 scoped_refptr<Authenticator> authenticator_;
195 scoped_ptr<OAuthLoginManager> login_manager_;
196 197
197 // Delegate to be fired when the profile will be prepared. 198 // Delegate to be fired when the profile will be prepared.
198 LoginUtils::Delegate* delegate_; 199 LoginUtils::Delegate* delegate_;
199 200
200 // True if should restore authentication session when notified about 201 // True if should restore authentication session when notified about
201 // online state change. 202 // online state change.
202 bool should_restore_auth_session_; 203 bool should_restore_auth_session_;
203 204
204 // Sesion restore strategy. 205 // Sesion restore strategy.
205 OAuthLoginManager::SessionRestoreStrategy session_restore_strategy_; 206 OAuth2LoginManager::SessionRestoreStrategy session_restore_strategy_;
206 // OAuth2 refresh token for session restore. 207 // OAuth2 refresh token for session restore.
207 std::string oauth2_refresh_token_; 208 std::string oauth2_refresh_token_;
208 209
209 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); 210 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl);
210 }; 211 };
211 212
212 class LoginUtilsWrapper { 213 class LoginUtilsWrapper {
213 public: 214 public:
214 static LoginUtilsWrapper* GetInstance() { 215 static LoginUtilsWrapper* GetInstance() {
215 return Singleton<LoginUtilsWrapper>::get(); 216 return Singleton<LoginUtilsWrapper>::get();
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 ::switches::kAppModeOAuth2Token); 386 ::switches::kAppModeOAuth2Token);
386 } 387 }
387 388
388 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) { 389 if (command_line->HasSwitch(::switches::kAppModeAuthCode)) {
389 user_context_.auth_code = command_line->GetSwitchValueASCII( 390 user_context_.auth_code = command_line->GetSwitchValueASCII(
390 ::switches::kAppModeAuthCode); 391 ::switches::kAppModeAuthCode);
391 } 392 }
392 393
393 DCHECK(!has_web_auth_cookies_); 394 DCHECK(!has_web_auth_cookies_);
394 if (!user_context_.auth_code.empty()) { 395 if (!user_context_.auth_code.empty()) {
395 session_restore_strategy_ = OAuthLoginManager::RESTORE_FROM_AUTH_CODE; 396 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_AUTH_CODE;
396 } else if (!oauth2_refresh_token_.empty()) { 397 } else if (!oauth2_refresh_token_.empty()) {
397 session_restore_strategy_ = 398 session_restore_strategy_ =
398 OAuthLoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN; 399 OAuth2LoginManager::RESTORE_FROM_PASSED_OAUTH2_REFRESH_TOKEN;
399 } else { 400 } else {
400 session_restore_strategy_ = 401 session_restore_strategy_ =
401 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; 402 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN;
402 } 403 }
403 return; 404 return;
404 } 405 }
405 406
406 if (has_web_auth_cookies_) { 407 if (has_web_auth_cookies_) {
407 session_restore_strategy_ = OAuthLoginManager::RESTORE_FROM_COOKIE_JAR; 408 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_COOKIE_JAR;
408 } else if (!user_context_.auth_code.empty()) { 409 } else if (!user_context_.auth_code.empty()) {
409 session_restore_strategy_ = OAuthLoginManager::RESTORE_FROM_AUTH_CODE; 410 session_restore_strategy_ = OAuth2LoginManager::RESTORE_FROM_AUTH_CODE;
410 } else { 411 } else {
411 session_restore_strategy_ = 412 session_restore_strategy_ =
412 OAuthLoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN; 413 OAuth2LoginManager::RESTORE_FROM_SAVED_OAUTH2_REFRESH_TOKEN;
413 } 414 }
414 } 415 }
415 416
416 417
417 void LoginUtilsImpl::OnProfileCreated( 418 void LoginUtilsImpl::OnProfileCreated(
418 Profile* user_profile, 419 Profile* user_profile,
419 Profile::CreateStatus status) { 420 Profile::CreateStatus status) {
420 CHECK(user_profile); 421 CHECK(user_profile);
421 422
422 switch (status) { 423 switch (status) {
(...skipping 29 matching lines...) Expand all
452 &LoginUtilsImpl::CompleteProfileCreate, 453 &LoginUtilsImpl::CompleteProfileCreate,
453 AsWeakPtr(), 454 AsWeakPtr(),
454 user_profile)); 455 user_profile));
455 return; 456 return;
456 } 457 }
457 458
458 FinalizePrepareProfile(user_profile); 459 FinalizePrepareProfile(user_profile);
459 } 460 }
460 461
461 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) { 462 void LoginUtilsImpl::CompleteProfileCreate(Profile* user_profile) {
463 should_finalize_profile_ = true;
462 RestoreAuthSession(user_profile, has_web_auth_cookies_); 464 RestoreAuthSession(user_profile, has_web_auth_cookies_);
463 FinalizePrepareProfile(user_profile);
464 } 465 }
465 466
466 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile, 467 void LoginUtilsImpl::RestoreAuthSession(Profile* user_profile,
467 bool restore_from_auth_cookies) { 468 bool restore_from_auth_cookies) {
468 CHECK((authenticator_.get() && authenticator_->authentication_profile()) || 469 CHECK((authenticator_.get() && authenticator_->authentication_profile()) ||
469 !restore_from_auth_cookies); 470 !restore_from_auth_cookies);
470 if (!login_manager_.get())
471 return;
472 471
473 if (chrome::IsRunningInForcedAppMode() || 472 if (chrome::IsRunningInForcedAppMode() ||
474 CommandLine::ForCurrentProcess()->HasSwitch( 473 CommandLine::ForCurrentProcess()->HasSwitch(
475 chromeos::switches::kOobeSkipPostLogin)) 474 chromeos::switches::kOobeSkipPostLogin))
476 return; 475 return;
477 476
478 UserManager::Get()->SetMergeSessionState( 477 UserManager::Get()->SetMergeSessionState(
479 UserManager::MERGE_STATUS_IN_PROCESS); 478 UserManager::MERGE_STATUS_PREPARING);
480 479
481 // Remove legacy OAuth1 token if we have one. If it's valid, we should already 480 // Remove legacy OAuth1 token if we have one. If it's valid, we should already
482 // have OAuth2 refresh token in TokenService that could be used to retrieve 481 // have OAuth2 refresh token in TokenService that could be used to retrieve
483 // all other tokens and user_context. 482 // all other tokens and user_context.
484 login_manager_->RestoreSession( 483 OAuth2LoginManager* login_manager =
485 user_profile, 484 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
485 login_manager->AddObserver(this);
486 login_manager->RestoreSession(
486 authenticator_.get() && authenticator_->authentication_profile() 487 authenticator_.get() && authenticator_->authentication_profile()
487 ? authenticator_->authentication_profile()->GetRequestContext() 488 ? authenticator_->authentication_profile()->GetRequestContext()
488 : NULL, 489 : NULL,
489 session_restore_strategy_, 490 session_restore_strategy_,
490 oauth2_refresh_token_, 491 oauth2_refresh_token_,
491 user_context_.auth_code); 492 user_context_.auth_code);
492 } 493 }
493 494
494 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) { 495 void LoginUtilsImpl::FinalizePrepareProfile(Profile* user_profile) {
495 BootTimesLoader* btl = BootTimesLoader::Get(); 496 BootTimesLoader* btl = BootTimesLoader::Get();
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 UserManager::Get()->IsLoggedInAsStub()) { 715 UserManager::Get()->IsLoggedInAsStub()) {
715 return; 716 return;
716 } 717 }
717 718
718 if (!net::NetworkChangeNotifier::IsOffline()) { 719 if (!net::NetworkChangeNotifier::IsOffline()) {
719 should_restore_auth_session_ = false; 720 should_restore_auth_session_ = false;
720 RestoreAuthSession(user_profile, false); 721 RestoreAuthSession(user_profile, false);
721 } else { 722 } else {
722 // Even if we're online we should wait till initial 723 // Even if we're online we should wait till initial
723 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may 724 // OnConnectionTypeChanged() call. Otherwise starting fetchers too early may
724 // end up cancelling all request when initial network connection type is 725 // end up canceling all request when initial network connection type is
725 // processed. See http://crbug.com/121643. 726 // processed. See http://crbug.com/121643.
726 should_restore_auth_session_ = true; 727 should_restore_auth_session_ = true;
727 } 728 }
728 } 729 }
729 730
730 void LoginUtilsImpl::StopBackgroundFetchers() {
731 login_manager_.reset();
732 }
733
734 void LoginUtilsImpl::OnCompletedAuthentication(Profile* user_profile) { 731 void LoginUtilsImpl::OnCompletedAuthentication(Profile* user_profile) {
735 StartSignedInServices(user_profile); 732 StartSignedInServices(user_profile);
736 } 733 }
737 734
738 void LoginUtilsImpl::OnCompletedMergeSession() { 735 void LoginUtilsImpl::OnStartMergeSession(Profile* user_profile) {
739 UserManager::Get()->SetMergeSessionState(UserManager::MERGE_STATUS_DONE); 736 UserManager::Get()->SetMergeSessionState(
737 UserManager::MERGE_STATUS_IN_PROCESS);
738
739 if (should_finalize_profile_)
740 FinalizePrepareProfile(user_profile);
741
742 should_finalize_profile_ = false;
740 } 743 }
741 744
742 void LoginUtilsImpl::OnFoundStoredTokens() { 745 void LoginUtilsImpl::OnCompletedMergeSession(Profile* user_profile) {
743 // We don't need authenticator instance any more since its cookie jar 746 OAuth2LoginManager* login_manager =
744 // is not going to needed to mint OAuth tokens. Reset it so that 747 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
745 // ScreenLocker would create a separate instance. 748 login_manager->RemoveObserver(this);
746 authenticator_ = NULL; 749 UserManager::Get()->SetMergeSessionState(UserManager::MERGE_STATUS_DONE);
747 } 750 }
748 751
749 void LoginUtilsImpl::OnConnectionTypeChanged( 752 void LoginUtilsImpl::OnConnectionTypeChanged(
750 net::NetworkChangeNotifier::ConnectionType type) { 753 net::NetworkChangeNotifier::ConnectionType type) {
751 if (!login_manager_.get()) 754 Profile* user_profile = ProfileManager::GetDefaultProfile();
752 return; 755 OAuth2LoginManager* login_manager =
756 OAuth2LoginManagerFactory::GetInstance()->GetForProfile(user_profile);
753 757
754 if (type != net::NetworkChangeNotifier::CONNECTION_NONE && 758 if (type != net::NetworkChangeNotifier::CONNECTION_NONE &&
755 UserManager::Get()->IsUserLoggedIn()) { 759 UserManager::Get()->IsUserLoggedIn()) {
756 if (login_manager_->state() == 760 if (login_manager->state() ==
757 OAuthLoginManager::SESSION_RESTORE_IN_PROGRESS) { 761 OAuth2LoginManager::SESSION_RESTORE_IN_PROGRESS) {
758 // If we come online for the first time after successful offline login, 762 // If we come online for the first time after successful offline login,
759 // we need to kick off OAuth token verification process again. 763 // we need to kick off OAuth token verification process again.
760 login_manager_->ContinueSessionRestore(); 764 login_manager->ContinueSessionRestore();
761 } else if (should_restore_auth_session_) { 765 } else if (should_restore_auth_session_) {
762 should_restore_auth_session_ = false; 766 should_restore_auth_session_ = false;
763 Profile* user_profile = ProfileManager::GetDefaultProfile();
764 RestoreAuthSession(user_profile, has_web_auth_cookies_); 767 RestoreAuthSession(user_profile, has_web_auth_cookies_);
765 } 768 }
766 } 769 }
767 } 770 }
768 771
769 // static 772 // static
770 void LoginUtils::RegisterPrefs(PrefRegistrySimple* registry) { 773 void LoginUtils::RegisterPrefs(PrefRegistrySimple* registry) {
771 registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false); 774 registry->RegisterBooleanPref(prefs::kFactoryResetRequested, false);
772 registry->RegisterStringPref(prefs::kRLZBrand, std::string()); 775 registry->RegisterStringPref(prefs::kRLZBrand, std::string());
773 registry->RegisterBooleanPref(prefs::kRLZDisabled, false); 776 registry->RegisterBooleanPref(prefs::kRLZDisabled, false);
(...skipping 13 matching lines...) Expand all
787 bool LoginUtils::IsWhitelisted(const std::string& username) { 790 bool LoginUtils::IsWhitelisted(const std::string& username) {
788 CrosSettings* cros_settings = CrosSettings::Get(); 791 CrosSettings* cros_settings = CrosSettings::Get();
789 bool allow_new_user = false; 792 bool allow_new_user = false;
790 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); 793 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user);
791 if (allow_new_user) 794 if (allow_new_user)
792 return true; 795 return true;
793 return cros_settings->FindEmailInList(kAccountsPrefUsers, username); 796 return cros_settings->FindEmailInList(kAccountsPrefUsers, username);
794 } 797 }
795 798
796 } // namespace chromeos 799 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698