| 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/chromeos/login/login_utils.h" | 5 #include "chrome/browser/chromeos/login/login_utils.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" | 12 #include "chrome/browser/chromeos/login/auth/chrome_cryptohome_authenticator.h" |
| 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 13 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
| 14 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 14 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 15 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 16 #include "chrome/browser/chromeos/settings/cros_settings.h" | 16 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 17 #include "chromeos/chromeos_switches.h" | 17 #include "chromeos/chromeos_switches.h" |
| 18 #include "chromeos/settings/cros_settings_names.h" | 18 #include "chromeos/settings/cros_settings_names.h" |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 class LoginUtilsImpl : public LoginUtils, | 22 class LoginUtilsImpl : public LoginUtils, |
| 23 public UserSessionManagerDelegate { | 23 public UserSessionManagerDelegate { |
| 24 public: | 24 public: |
| 25 LoginUtilsImpl() | 25 LoginUtilsImpl() |
| 26 : delegate_(NULL) { | 26 : delegate_(NULL) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual ~LoginUtilsImpl() { | 29 ~LoginUtilsImpl() override {} |
| 30 } | |
| 31 | 30 |
| 32 // LoginUtils implementation: | 31 // LoginUtils implementation: |
| 33 virtual void DoBrowserLaunch(Profile* profile, | 32 void DoBrowserLaunch(Profile* profile, LoginDisplayHost* login_host) override; |
| 34 LoginDisplayHost* login_host) override; | 33 void PrepareProfile(const UserContext& user_context, |
| 35 virtual void PrepareProfile( | 34 bool has_auth_cookies, |
| 36 const UserContext& user_context, | 35 bool has_active_session, |
| 37 bool has_auth_cookies, | 36 LoginUtils::Delegate* delegate) override; |
| 38 bool has_active_session, | 37 void DelegateDeleted(LoginUtils::Delegate* delegate) override; |
| 39 LoginUtils::Delegate* delegate) override; | 38 scoped_refptr<Authenticator> CreateAuthenticator( |
| 40 virtual void DelegateDeleted(LoginUtils::Delegate* delegate) override; | |
| 41 virtual scoped_refptr<Authenticator> CreateAuthenticator( | |
| 42 AuthStatusConsumer* consumer) override; | 39 AuthStatusConsumer* consumer) override; |
| 43 | 40 |
| 44 // UserSessionManager::Delegate implementation: | 41 // UserSessionManager::Delegate implementation: |
| 45 virtual void OnProfilePrepared(Profile* profile, | 42 void OnProfilePrepared(Profile* profile, bool browser_launched) override; |
| 46 bool browser_launched) override; | |
| 47 | 43 |
| 48 private: | 44 private: |
| 49 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). | 45 // Has to be scoped_refptr, see comment for CreateAuthenticator(...). |
| 50 scoped_refptr<Authenticator> authenticator_; | 46 scoped_refptr<Authenticator> authenticator_; |
| 51 | 47 |
| 52 // Delegate to be fired when the profile will be prepared. | 48 // Delegate to be fired when the profile will be prepared. |
| 53 LoginUtils::Delegate* delegate_; | 49 LoginUtils::Delegate* delegate_; |
| 54 | 50 |
| 55 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); | 51 DISALLOW_COPY_AND_ASSIGN(LoginUtilsImpl); |
| 56 }; | 52 }; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 CrosSettings* cros_settings = CrosSettings::Get(); | 161 CrosSettings* cros_settings = CrosSettings::Get(); |
| 166 bool allow_new_user = false; | 162 bool allow_new_user = false; |
| 167 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 163 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 168 if (allow_new_user) | 164 if (allow_new_user) |
| 169 return true; | 165 return true; |
| 170 return cros_settings->FindEmailInList( | 166 return cros_settings->FindEmailInList( |
| 171 kAccountsPrefUsers, username, wildcard_match); | 167 kAccountsPrefUsers, username, wildcard_match); |
| 172 } | 168 } |
| 173 | 169 |
| 174 } // namespace chromeos | 170 } // namespace chromeos |
| OLD | NEW |