| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/task.h" | 14 #include "base/task.h" |
| 14 #include "chrome/browser/chromeos/login/authenticator.h" | 15 #include "chrome/browser/chromeos/login/authenticator.h" |
| 15 #include "chrome/browser/chromeos/login/login_status_consumer.h" | 16 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 16 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/common/net/gaia/google_service_auth_error.h" | 18 #include "chrome/common/net/gaia/google_service_auth_error.h" |
| 19 #include "content/common/notification_observer.h" | 19 #include "content/common/notification_observer.h" |
| 20 #include "content/common/notification_registrar.h" | 20 #include "content/common/notification_registrar.h" |
| 21 | 21 |
| 22 namespace chromeos { | 22 namespace chromeos { |
| 23 | 23 |
| 24 // This class encapsulates sign in operations. | 24 // This class encapsulates sign in operations. |
| 25 // Sign in is performed in a way that offline auth is executed first. | 25 // Sign in is performed in a way that offline auth is executed first. |
| 26 // Once offline auth is OK - user homedir is mounted, UI is launched. | 26 // Once offline auth is OK - user homedir is mounted, UI is launched. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 45 // CAPTCHA dialog, password input. | 45 // CAPTCHA dialog, password input. |
| 46 // If |delegate_| is NULL that does mean that LoginPerformer instance | 46 // If |delegate_| is NULL that does mean that LoginPerformer instance |
| 47 // is waiting for successful online login or blocked on online login failure. | 47 // is waiting for successful online login or blocked on online login failure. |
| 48 // In case of failure password/captcha | 48 // In case of failure password/captcha |
| 49 // input & error messages display is dedicated to ScreenLocker instance. | 49 // input & error messages display is dedicated to ScreenLocker instance. |
| 50 // | 50 // |
| 51 // 2 things make LoginPerfrormer instance exist longer: | 51 // 2 things make LoginPerfrormer instance exist longer: |
| 52 // 1. ScreenLock active (pending correct new password input) | 52 // 1. ScreenLock active (pending correct new password input) |
| 53 // 2. Pending online auth request. | 53 // 2. Pending online auth request. |
| 54 class LoginPerformer : public LoginStatusConsumer, | 54 class LoginPerformer : public LoginStatusConsumer, |
| 55 public SignedSettingsHelper::Callback, | |
| 56 public NotificationObserver, | 55 public NotificationObserver, |
| 57 public ProfileManagerObserver { | 56 public ProfileManagerObserver { |
| 58 public: | 57 public: |
| 59 // Delegate class to get notifications from the LoginPerformer. | 58 // Delegate class to get notifications from the LoginPerformer. |
| 60 class Delegate : public LoginStatusConsumer { | 59 class Delegate : public LoginStatusConsumer { |
| 61 public: | 60 public: |
| 62 virtual ~Delegate() {} | 61 virtual ~Delegate() {} |
| 63 virtual void WhiteListCheckFailed(const std::string& email) = 0; | 62 virtual void WhiteListCheckFailed(const std::string& email) = 0; |
| 64 }; | 63 }; |
| 65 | 64 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 AUTH_MODE_EXTENSION | 120 AUTH_MODE_EXTENSION |
| 122 } AuthorizationMode; | 121 } AuthorizationMode; |
| 123 AuthorizationMode auth_mode() const { return auth_mode_; } | 122 AuthorizationMode auth_mode() const { return auth_mode_; } |
| 124 | 123 |
| 125 private: | 124 private: |
| 126 // NotificationObserver implementation: | 125 // NotificationObserver implementation: |
| 127 virtual void Observe(int type, | 126 virtual void Observe(int type, |
| 128 const NotificationSource& source, | 127 const NotificationSource& source, |
| 129 const NotificationDetails& details) OVERRIDE; | 128 const NotificationDetails& details) OVERRIDE; |
| 130 | 129 |
| 131 // SignedSettingsHelper::Callback implementation: | |
| 132 virtual void OnCheckWhitelistCompleted(SignedSettings::ReturnCode code, | |
| 133 const std::string& email) OVERRIDE; | |
| 134 | |
| 135 // ProfileManagerObserver implementation: | 130 // ProfileManagerObserver implementation: |
| 136 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE; | 131 virtual void OnProfileCreated(Profile* profile, Status status) OVERRIDE; |
| 137 | 132 |
| 138 // Requests screen lock and subscribes to screen lock notifications. | 133 // Requests screen lock and subscribes to screen lock notifications. |
| 139 void RequestScreenLock(); | 134 void RequestScreenLock(); |
| 140 | 135 |
| 141 // Requests screen unlock. | 136 // Requests screen unlock. |
| 142 void RequestScreenUnlock(); | 137 void RequestScreenUnlock(); |
| 143 | 138 |
| 144 // Resolves initial LoginFailure::NETWORK_AUTH_FAILED error i.e. | 139 // Resolves initial LoginFailure::NETWORK_AUTH_FAILED error i.e. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 bool initial_online_auth_pending_; | 200 bool initial_online_auth_pending_; |
| 206 | 201 |
| 207 GaiaAuthConsumer::ClientLoginResult credentials_; | 202 GaiaAuthConsumer::ClientLoginResult credentials_; |
| 208 | 203 |
| 209 // Authorization mode type. | 204 // Authorization mode type. |
| 210 AuthorizationMode auth_mode_; | 205 AuthorizationMode auth_mode_; |
| 211 | 206 |
| 212 // True if we use OAuth during authorization process. | 207 // True if we use OAuth during authorization process. |
| 213 bool using_oauth_; | 208 bool using_oauth_; |
| 214 | 209 |
| 215 ScopedRunnableMethodFactory<LoginPerformer> method_factory_; | 210 base::WeakPtrFactory<LoginPerformer> pointer_factory_; |
| 216 | 211 |
| 217 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); | 212 DISALLOW_COPY_AND_ASSIGN(LoginPerformer); |
| 218 }; | 213 }; |
| 219 | 214 |
| 220 } // namespace chromeos | 215 } // namespace chromeos |
| 221 | 216 |
| 222 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ | 217 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_PERFORMER_H_ |
| OLD | NEW |