| 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_WIZARD_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 12 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
| 13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 15 #include "base/macros.h" |
| 15 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.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/observer_list.h" | 18 #include "base/observer_list.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/accessibility/accessibility_manager.h" | 21 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
| 22 #include "chrome/browser/chromeos/login/screen_manager.h" | 22 #include "chrome/browser/chromeos/login/screen_manager.h" |
| 23 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 23 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 24 #include "chrome/browser/chromeos/login/screens/controller_pairing_screen.h" | 24 #include "chrome/browser/chromeos/login/screens/controller_pairing_screen.h" |
| 25 #include "chrome/browser/chromeos/login/screens/eula_screen.h" | 25 #include "chrome/browser/chromeos/login/screens/eula_screen.h" |
| 26 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" | 26 #include "chrome/browser/chromeos/login/screens/hid_detection_screen.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 | 291 |
| 292 std::string first_screen_name() { return first_screen_name_; } | 292 std::string first_screen_name() { return first_screen_name_; } |
| 293 | 293 |
| 294 // Called when network is UP. | 294 // Called when network is UP. |
| 295 void StartTimezoneResolve(); | 295 void StartTimezoneResolve(); |
| 296 | 296 |
| 297 // Creates provider on demand. | 297 // Creates provider on demand. |
| 298 TimeZoneProvider* GetTimezoneProvider(); | 298 TimeZoneProvider* GetTimezoneProvider(); |
| 299 | 299 |
| 300 // TimeZoneRequest::TimeZoneResponseCallback implementation. | 300 // TimeZoneRequest::TimeZoneResponseCallback implementation. |
| 301 void OnTimezoneResolved(scoped_ptr<TimeZoneResponseData> timezone, | 301 void OnTimezoneResolved(std::unique_ptr<TimeZoneResponseData> timezone, |
| 302 bool server_error); | 302 bool server_error); |
| 303 | 303 |
| 304 // Called from SimpleGeolocationProvider when location is resolved. | 304 // Called from SimpleGeolocationProvider when location is resolved. |
| 305 void OnLocationResolved(const Geoposition& position, | 305 void OnLocationResolved(const Geoposition& position, |
| 306 bool server_error, | 306 bool server_error, |
| 307 const base::TimeDelta elapsed); | 307 const base::TimeDelta elapsed); |
| 308 | 308 |
| 309 // Returns true if callback has been installed. | 309 // Returns true if callback has been installed. |
| 310 // Returns false if timezone has already been resolved. | 310 // Returns false if timezone has already been resolved. |
| 311 bool SetOnTimeZoneResolvedForTesting(const base::Closure& callback); | 311 bool SetOnTimeZoneResolvedForTesting(const base::Closure& callback); |
| 312 | 312 |
| 313 // Returns true if kHostPairingOobe perf has been set. If it's set, launch the | 313 // Returns true if kHostPairingOobe perf has been set. If it's set, launch the |
| 314 // pairing remora OOBE from the beginning no matter an eligible controller is | 314 // pairing remora OOBE from the beginning no matter an eligible controller is |
| 315 // detected or not. | 315 // detected or not. |
| 316 bool IsRemoraPairingOobe() const; | 316 bool IsRemoraPairingOobe() const; |
| 317 | 317 |
| 318 // Starts listening for an incoming shark controller connection, if we are | 318 // Starts listening for an incoming shark controller connection, if we are |
| 319 // running remora OOBE. | 319 // running remora OOBE. |
| 320 void MaybeStartListeningForSharkConnection(); | 320 void MaybeStartListeningForSharkConnection(); |
| 321 | 321 |
| 322 // Called when a connection to controller has been established. Wizard | 322 // Called when a connection to controller has been established. Wizard |
| 323 // controller takes the ownership of |pairing_controller| after that call. | 323 // controller takes the ownership of |pairing_controller| after that call. |
| 324 void OnSharkConnected( | 324 void OnSharkConnected(std::unique_ptr<pairing_chromeos::HostPairingController> |
| 325 scoped_ptr<pairing_chromeos::HostPairingController> pairing_controller); | 325 pairing_controller); |
| 326 | 326 |
| 327 // Callback function for AddNetworkRequested(). | 327 // Callback function for AddNetworkRequested(). |
| 328 void OnSetHostNetworkFailed(); | 328 void OnSetHostNetworkFailed(); |
| 329 | 329 |
| 330 // Start the enrollment screen using the config from | 330 // Start the enrollment screen using the config from |
| 331 // |prescribed_enrollment_config_|. | 331 // |prescribed_enrollment_config_|. |
| 332 void StartEnrollmentScreen(); | 332 void StartEnrollmentScreen(); |
| 333 | 333 |
| 334 // Whether to skip any screens that may normally be shown after login | 334 // Whether to skip any screens that may normally be shown after login |
| 335 // (registration, Terms of Service, user image selection). | 335 // (registration, Terms of Service, user image selection). |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 // Non-owning pointer to local state used for testing. | 403 // Non-owning pointer to local state used for testing. |
| 404 static PrefService* local_state_for_testing_; | 404 static PrefService* local_state_for_testing_; |
| 405 | 405 |
| 406 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); | 406 FRIEND_TEST_ALL_PREFIXES(EnrollmentScreenTest, TestCancel); |
| 407 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, Accelerators); | 407 FRIEND_TEST_ALL_PREFIXES(WizardControllerFlowTest, Accelerators); |
| 408 friend class WizardControllerFlowTest; | 408 friend class WizardControllerFlowTest; |
| 409 friend class WizardControllerOobeResumeTest; | 409 friend class WizardControllerOobeResumeTest; |
| 410 friend class WizardInProcessBrowserTest; | 410 friend class WizardInProcessBrowserTest; |
| 411 friend class WizardControllerBrokenLocalStateTest; | 411 friend class WizardControllerBrokenLocalStateTest; |
| 412 | 412 |
| 413 scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_; | 413 std::unique_ptr<AccessibilityStatusSubscription> accessibility_subscription_; |
| 414 | 414 |
| 415 scoped_ptr<SimpleGeolocationProvider> geolocation_provider_; | 415 std::unique_ptr<SimpleGeolocationProvider> geolocation_provider_; |
| 416 scoped_ptr<TimeZoneProvider> timezone_provider_; | 416 std::unique_ptr<TimeZoneProvider> timezone_provider_; |
| 417 | 417 |
| 418 // Pairing controller for shark devices. | 418 // Pairing controller for shark devices. |
| 419 scoped_ptr<pairing_chromeos::ControllerPairingController> shark_controller_; | 419 std::unique_ptr<pairing_chromeos::ControllerPairingController> |
| 420 shark_controller_; |
| 420 | 421 |
| 421 // Pairing controller for remora devices. | 422 // Pairing controller for remora devices. |
| 422 scoped_ptr<pairing_chromeos::HostPairingController> remora_controller_; | 423 std::unique_ptr<pairing_chromeos::HostPairingController> remora_controller_; |
| 423 | 424 |
| 424 // Maps screen ids to last time of their shows. | 425 // Maps screen ids to last time of their shows. |
| 425 base::hash_map<std::string, base::Time> screen_show_times_; | 426 base::hash_map<std::string, base::Time> screen_show_times_; |
| 426 | 427 |
| 427 // Tests check result of timezone resolve. | 428 // Tests check result of timezone resolve. |
| 428 bool timezone_resolved_ = false; | 429 bool timezone_resolved_ = false; |
| 429 base::Closure on_timezone_resolved_for_testing_; | 430 base::Closure on_timezone_resolved_for_testing_; |
| 430 | 431 |
| 431 // Listens for incoming connection from a shark controller if a regular (not | 432 // Listens for incoming connection from a shark controller if a regular (not |
| 432 // pairing) remora OOBE is active. If connection is established, wizard | 433 // pairing) remora OOBE is active. If connection is established, wizard |
| 433 // conroller swithces to a pairing OOBE. | 434 // conroller swithces to a pairing OOBE. |
| 434 scoped_ptr<pairing_chromeos::SharkConnectionListener> | 435 std::unique_ptr<pairing_chromeos::SharkConnectionListener> |
| 435 shark_connection_listener_; | 436 shark_connection_listener_; |
| 436 | 437 |
| 437 BaseScreen* hid_screen_ = nullptr; | 438 BaseScreen* hid_screen_ = nullptr; |
| 438 | 439 |
| 439 base::WeakPtrFactory<WizardController> weak_factory_; | 440 base::WeakPtrFactory<WizardController> weak_factory_; |
| 440 | 441 |
| 441 DISALLOW_COPY_AND_ASSIGN(WizardController); | 442 DISALLOW_COPY_AND_ASSIGN(WizardController); |
| 442 }; | 443 }; |
| 443 | 444 |
| 444 } // namespace chromeos | 445 } // namespace chromeos |
| 445 | 446 |
| 446 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ | 447 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_WIZARD_CONTROLLER_H_ |
| OLD | NEW |