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_EXISTING_USER_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" |
13 #include "base/string16.h" | 14 #include "base/string16.h" |
14 #include "base/task.h" | 15 #include "base/task.h" |
15 #include "base/timer.h" | 16 #include "base/timer.h" |
16 #include "chrome/browser/chromeos/login/captcha_view.h" | 17 #include "chrome/browser/chromeos/login/captcha_view.h" |
17 #include "chrome/browser/chromeos/login/login_display.h" | 18 #include "chrome/browser/chromeos/login/login_display.h" |
18 #include "chrome/browser/chromeos/login/login_performer.h" | 19 #include "chrome/browser/chromeos/login/login_performer.h" |
19 #include "chrome/browser/chromeos/login/login_utils.h" | 20 #include "chrome/browser/chromeos/login/login_utils.h" |
20 #include "chrome/browser/chromeos/login/ownership_status_checker.h" | 21 #include "chrome/browser/chromeos/login/ownership_status_checker.h" |
21 #include "chrome/browser/chromeos/login/password_changed_view.h" | 22 #include "chrome/browser/chromeos/login/password_changed_view.h" |
22 #include "chrome/browser/chromeos/login/user_manager.h" | 23 #include "chrome/browser/chromeos/login/user_manager.h" |
23 #include "chrome/browser/chromeos/wm_message_listener.h" | 24 #include "chrome/browser/chromeos/wm_message_listener.h" |
24 #include "content/common/notification_observer.h" | 25 #include "content/common/notification_observer.h" |
25 #include "content/common/notification_registrar.h" | 26 #include "content/common/notification_registrar.h" |
26 #include "googleurl/src/gurl.h" | 27 #include "googleurl/src/gurl.h" |
27 #include "testing/gtest/include/gtest/gtest_prod.h" | 28 #include "testing/gtest/include/gtest/gtest_prod.h" |
28 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
29 | 30 |
30 namespace chromeos { | 31 namespace chromeos { |
31 | 32 |
32 class LoginDisplayHost; | 33 class LoginDisplayHost; |
33 class UserCrosSettingsProvider; | 34 class CrosSettings; |
34 | 35 |
35 // ExistingUserController is used to handle login when someone has | 36 // ExistingUserController is used to handle login when someone has |
36 // already logged into the machine. | 37 // already logged into the machine. |
37 // To use ExistingUserController create an instance of it and invoke Init. | 38 // To use ExistingUserController create an instance of it and invoke Init. |
38 // When Init is called it creates LoginDisplay instance which encapsulates | 39 // When Init is called it creates LoginDisplay instance which encapsulates |
39 // all login UI implementation. | 40 // all login UI implementation. |
40 // ExistingUserController maintains it's own life cycle and deletes itself when | 41 // ExistingUserController maintains it's own life cycle and deletes itself when |
41 // the user logs in (or chooses to see other settings). | 42 // the user logs in (or chooses to see other settings). |
42 class ExistingUserController : public LoginDisplay::Delegate, | 43 class ExistingUserController : public LoginDisplay::Delegate, |
43 public NotificationObserver, | 44 public NotificationObserver, |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 170 |
170 // Number of login attempts. Used to show help link when > 1 unsuccessful | 171 // Number of login attempts. Used to show help link when > 1 unsuccessful |
171 // logins for the same user. | 172 // logins for the same user. |
172 size_t num_login_attempts_; | 173 size_t num_login_attempts_; |
173 | 174 |
174 // Pointer to the current instance of the controller to be used by | 175 // Pointer to the current instance of the controller to be used by |
175 // automation tests. | 176 // automation tests. |
176 static ExistingUserController* current_controller_; | 177 static ExistingUserController* current_controller_; |
177 | 178 |
178 // Triggers prefetching of user settings. | 179 // Triggers prefetching of user settings. |
179 scoped_ptr<UserCrosSettingsProvider> user_settings_; | 180 CrosSettings* user_settings_; |
180 | 181 |
181 // URL to append to start Guest mode with. | 182 // URL to append to start Guest mode with. |
182 GURL guest_mode_url_; | 183 GURL guest_mode_url_; |
183 | 184 |
184 // Used for user image changed notifications. | 185 // Used for user image changed notifications. |
185 NotificationRegistrar registrar_; | 186 NotificationRegistrar registrar_; |
186 | 187 |
187 // Factory of callbacks. | 188 // Factory of callbacks. |
188 ScopedRunnableMethodFactory<ExistingUserController> method_factory_; | 189 base::WeakPtrFactory<ExistingUserController> pointer_factory_; |
189 | 190 |
190 // Whether everything is ready to launch the browser. | 191 // Whether everything is ready to launch the browser. |
191 bool ready_for_browser_launch_; | 192 bool ready_for_browser_launch_; |
192 | 193 |
193 // Whether two factor credentials were used. | 194 // Whether two factor credentials were used. |
194 bool two_factor_credentials_; | 195 bool two_factor_credentials_; |
195 | 196 |
196 // Used to verify ownership before starting enterprise enrollment. | 197 // Used to verify ownership before starting enterprise enrollment. |
197 scoped_ptr<OwnershipStatusChecker> ownership_checker_; | 198 scoped_ptr<OwnershipStatusChecker> ownership_checker_; |
198 | 199 |
199 // Whether it's first login to the device and this user will be owner. | 200 // Whether it's first login to the device and this user will be owner. |
200 bool is_owner_login_; | 201 bool is_owner_login_; |
201 | 202 |
202 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, NewUserLogin); | 203 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, NewUserLogin); |
203 | 204 |
204 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 205 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
205 }; | 206 }; |
206 | 207 |
207 } // namespace chromeos | 208 } // namespace chromeos |
208 | 209 |
209 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 210 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
OLD | NEW |