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