| 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 #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 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 10 #include <string> | 11 #include <string> |
| 11 | 12 |
| 12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 15 #include "base/macros.h" | 16 #include "base/macros.h" |
| 16 #include "base/memory/scoped_ptr.h" | |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 19 #include "base/time/time.h" | 19 #include "base/time/time.h" |
| 20 #include "base/timer/timer.h" | 20 #include "base/timer/timer.h" |
| 21 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 21 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 22 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 22 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 23 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" | 23 #include "chrome/browser/chromeos/login/signin/token_handle_util.h" |
| 24 #include "chrome/browser/chromeos/login/ui/login_display.h" | 24 #include "chrome/browser/chromeos/login/ui/login_display.h" |
| 25 #include "chrome/browser/chromeos/settings/cros_settings.h" | 25 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 26 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 26 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void UpdateLoginDisplay(const user_manager::UserList& users); | 206 void UpdateLoginDisplay(const user_manager::UserList& users); |
| 207 | 207 |
| 208 // Sends an accessibility alert event to extension listeners. | 208 // Sends an accessibility alert event to extension listeners. |
| 209 void SendAccessibilityAlert(const std::string& alert_text); | 209 void SendAccessibilityAlert(const std::string& alert_text); |
| 210 | 210 |
| 211 // Callback invoked when the keyboard layouts available for a public session | 211 // Callback invoked when the keyboard layouts available for a public session |
| 212 // have been retrieved. Selects the first layout from the list and continues | 212 // have been retrieved. Selects the first layout from the list and continues |
| 213 // login. | 213 // login. |
| 214 void SetPublicSessionKeyboardLayoutAndLogin( | 214 void SetPublicSessionKeyboardLayoutAndLogin( |
| 215 const UserContext& user_context, | 215 const UserContext& user_context, |
| 216 scoped_ptr<base::ListValue> keyboard_layouts); | 216 std::unique_ptr<base::ListValue> keyboard_layouts); |
| 217 | 217 |
| 218 // Starts the actual login process for a public session. Invoked when all | 218 // Starts the actual login process for a public session. Invoked when all |
| 219 // preconditions have been verified. | 219 // preconditions have been verified. |
| 220 void LoginAsPublicSessionInternal(const UserContext& user_context); | 220 void LoginAsPublicSessionInternal(const UserContext& user_context); |
| 221 | 221 |
| 222 // Performs sets of actions right prior to login has been started. | 222 // Performs sets of actions right prior to login has been started. |
| 223 void PerformPreLoginActions(const UserContext& user_context); | 223 void PerformPreLoginActions(const UserContext& user_context); |
| 224 | 224 |
| 225 // Performs set of actions when login has been completed or has been | 225 // Performs set of actions when login has been completed or has been |
| 226 // cancelled. If |start_public_session_timer| is true than public session | 226 // cancelled. If |start_public_session_timer| is true than public session |
| (...skipping 18 matching lines...) Expand all Loading... |
| 245 | 245 |
| 246 // Callback invoked when |oauth2_token_initializer_| has finished. | 246 // Callback invoked when |oauth2_token_initializer_| has finished. |
| 247 void OnOAuth2TokensFetched(bool success, const UserContext& user_context); | 247 void OnOAuth2TokensFetched(bool success, const UserContext& user_context); |
| 248 | 248 |
| 249 // Callback invoked when |token_handle_util_| finishes token check. | 249 // Callback invoked when |token_handle_util_| finishes token check. |
| 250 void OnTokenHandleChecked( | 250 void OnTokenHandleChecked( |
| 251 const AccountId&, | 251 const AccountId&, |
| 252 TokenHandleUtil::TokenHandleStatus token_handle_status); | 252 TokenHandleUtil::TokenHandleStatus token_handle_status); |
| 253 | 253 |
| 254 // Public session auto-login timer. | 254 // Public session auto-login timer. |
| 255 scoped_ptr<base::OneShotTimer> auto_login_timer_; | 255 std::unique_ptr<base::OneShotTimer> auto_login_timer_; |
| 256 | 256 |
| 257 // Public session auto-login timeout, in milliseconds. | 257 // Public session auto-login timeout, in milliseconds. |
| 258 int public_session_auto_login_delay_; | 258 int public_session_auto_login_delay_; |
| 259 | 259 |
| 260 // AccountId for public session auto-login. | 260 // AccountId for public session auto-login. |
| 261 AccountId public_session_auto_login_account_id_ = EmptyAccountId(); | 261 AccountId public_session_auto_login_account_id_ = EmptyAccountId(); |
| 262 | 262 |
| 263 // Used to execute login operations. | 263 // Used to execute login operations. |
| 264 scoped_ptr<LoginPerformer> login_performer_; | 264 std::unique_ptr<LoginPerformer> login_performer_; |
| 265 | 265 |
| 266 // Delegate to forward all authentication status events to. | 266 // Delegate to forward all authentication status events to. |
| 267 // Tests can use this to receive authentication status events. | 267 // Tests can use this to receive authentication status events. |
| 268 AuthStatusConsumer* auth_status_consumer_ = nullptr; | 268 AuthStatusConsumer* auth_status_consumer_ = nullptr; |
| 269 | 269 |
| 270 // AccountId of the last login attempt. | 270 // AccountId of the last login attempt. |
| 271 AccountId last_login_attempt_account_id_ = EmptyAccountId(); | 271 AccountId last_login_attempt_account_id_ = EmptyAccountId(); |
| 272 | 272 |
| 273 // OOBE/login display host. | 273 // OOBE/login display host. |
| 274 LoginDisplayHost* host_; | 274 LoginDisplayHost* host_; |
| 275 | 275 |
| 276 // Login UI implementation instance. | 276 // Login UI implementation instance. |
| 277 scoped_ptr<LoginDisplay> login_display_; | 277 std::unique_ptr<LoginDisplay> login_display_; |
| 278 | 278 |
| 279 // Number of login attempts. Used to show help link when > 1 unsuccessful | 279 // Number of login attempts. Used to show help link when > 1 unsuccessful |
| 280 // logins for the same user. | 280 // logins for the same user. |
| 281 size_t num_login_attempts_ = 0; | 281 size_t num_login_attempts_ = 0; |
| 282 | 282 |
| 283 // Pointer to the current instance of the controller to be used by | 283 // Pointer to the current instance of the controller to be used by |
| 284 // automation tests. | 284 // automation tests. |
| 285 static ExistingUserController* current_controller_; | 285 static ExistingUserController* current_controller_; |
| 286 | 286 |
| 287 // Interface to the signed settings store. | 287 // Interface to the signed settings store. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 314 // Indicates use of local (not GAIA) authentication. | 314 // Indicates use of local (not GAIA) authentication. |
| 315 bool auth_flow_offline_ = false; | 315 bool auth_flow_offline_ = false; |
| 316 | 316 |
| 317 // Time when the signin screen was first displayed. Used to measure the time | 317 // Time when the signin screen was first displayed. Used to measure the time |
| 318 // from showing the screen until a successful login is performed. | 318 // from showing the screen until a successful login is performed. |
| 319 base::Time time_init_; | 319 base::Time time_init_; |
| 320 | 320 |
| 321 // Timer for the interval to wait for the reboot after TPM error UI was shown. | 321 // Timer for the interval to wait for the reboot after TPM error UI was shown. |
| 322 base::OneShotTimer reboot_timer_; | 322 base::OneShotTimer reboot_timer_; |
| 323 | 323 |
| 324 scoped_ptr<login::NetworkStateHelper> network_state_helper_; | 324 std::unique_ptr<login::NetworkStateHelper> network_state_helper_; |
| 325 | 325 |
| 326 scoped_ptr<CrosSettings::ObserverSubscription> show_user_names_subscription_; | 326 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 327 scoped_ptr<CrosSettings::ObserverSubscription> allow_new_user_subscription_; | 327 show_user_names_subscription_; |
| 328 scoped_ptr<CrosSettings::ObserverSubscription> | 328 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 329 allow_new_user_subscription_; |
| 330 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 329 allow_supervised_user_subscription_; | 331 allow_supervised_user_subscription_; |
| 330 scoped_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_; | 332 std::unique_ptr<CrosSettings::ObserverSubscription> allow_guest_subscription_; |
| 331 scoped_ptr<CrosSettings::ObserverSubscription> users_subscription_; | 333 std::unique_ptr<CrosSettings::ObserverSubscription> users_subscription_; |
| 332 scoped_ptr<CrosSettings::ObserverSubscription> | 334 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 333 local_account_auto_login_id_subscription_; | 335 local_account_auto_login_id_subscription_; |
| 334 scoped_ptr<CrosSettings::ObserverSubscription> | 336 std::unique_ptr<CrosSettings::ObserverSubscription> |
| 335 local_account_auto_login_delay_subscription_; | 337 local_account_auto_login_delay_subscription_; |
| 336 | 338 |
| 337 scoped_ptr<BootstrapUserContextInitializer> | 339 std::unique_ptr<BootstrapUserContextInitializer> |
| 338 bootstrap_user_context_initializer_; | 340 bootstrap_user_context_initializer_; |
| 339 | 341 |
| 340 scoped_ptr<OAuth2TokenInitializer> oauth2_token_initializer_; | 342 std::unique_ptr<OAuth2TokenInitializer> oauth2_token_initializer_; |
| 341 | 343 |
| 342 scoped_ptr<TokenHandleUtil> token_handle_util_; | 344 std::unique_ptr<TokenHandleUtil> token_handle_util_; |
| 343 | 345 |
| 344 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); | 346 FRIEND_TEST_ALL_PREFIXES(ExistingUserControllerTest, ExistingUserLogin); |
| 345 | 347 |
| 346 // Factory of callbacks. | 348 // Factory of callbacks. |
| 347 base::WeakPtrFactory<ExistingUserController> weak_factory_; | 349 base::WeakPtrFactory<ExistingUserController> weak_factory_; |
| 348 | 350 |
| 349 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); | 351 DISALLOW_COPY_AND_ASSIGN(ExistingUserController); |
| 350 }; | 352 }; |
| 351 | 353 |
| 352 } // namespace chromeos | 354 } // namespace chromeos |
| 353 | 355 |
| 354 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ | 356 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_EXISTING_USER_CONTROLLER_H_ |
| OLD | NEW |