locally_managed_user_creation_screen.h revision 868fa2fe829687343ffae624259930155e16dbd8
1// Copyright (c) 2013 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_SCREEN_H_ 6#define CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_SCREEN_H_ 7 8#include <string> 9 10#include "base/basictypes.h" 11#include "base/compiler_specific.h" 12#include "chrome/browser/chromeos/login/managed/locally_managed_user_creation_controller.h" 13#include "chrome/browser/chromeos/login/screens/wizard_screen.h" 14#include "chrome/browser/chromeos/net/network_portal_detector.h" 15#include "chrome/browser/ui/webui/chromeos/login/locally_managed_user_creation_screen_handler.h" 16 17class Profile; 18 19namespace chromeos { 20 21class NetworkState; 22 23// Class that controls screen showing ui for locally managed user creation. 24class LocallyManagedUserCreationScreen 25 : public WizardScreen, 26 public LocallyManagedUserCreationScreenHandler::Delegate, 27 public LocallyManagedUserCreationController::StatusConsumer, 28 public NetworkPortalDetector::Observer { 29 public: 30 LocallyManagedUserCreationScreen( 31 ScreenObserver* observer, 32 LocallyManagedUserCreationScreenHandler* actor); 33 virtual ~LocallyManagedUserCreationScreen(); 34 35 // Makes screen to show message about inconsistency in manager login flow 36 // (e.g. password change detected, invalid OAuth token, etc). 37 // Called when manager user is successfully authenticated, so ui elements 38 // should result in forced logout. 39 void ShowManagerInconsistentStateErrorScreen(); 40 41 // Called when authentication fails for manager with provided password. 42 // Displays wrong password message on manager selection screen. 43 void OnManagerLoginFailure(); 44 45 // Called when manager is successfully authenticated and account is in 46 // consistent state. 47 void OnManagerFullyAuthenticated(Profile* manager_profile); 48 49 // Called when manager is successfully authenticated against cryptohome, but 50 // OAUTH token validation hasn't completed yet. 51 // Results in spinner indicating that creation is in process. 52 void OnManagerCryptohomeAuthenticated(); 53 54 // Shows initial screen where managed user name/password are defined and 55 // manager is selected. 56 void ShowInitialScreen(); 57 58 // WizardScreen implementation: 59 virtual void PrepareToShow() OVERRIDE; 60 virtual void Show() OVERRIDE; 61 virtual void Hide() OVERRIDE; 62 virtual std::string GetName() const OVERRIDE; 63 64 // LocallyManagedUserCreationScreenHandler::Delegate implementation: 65 virtual void OnExit() OVERRIDE; 66 virtual void OnActorDestroyed(LocallyManagedUserCreationScreenHandler* actor) 67 OVERRIDE; 68 virtual void CreateManagedUser( 69 const string16& display_name, 70 const std::string& managed_user_password) OVERRIDE; 71 virtual void AuthenticateManager( 72 const std::string& manager_id, 73 const std::string& manager_password) OVERRIDE; 74 virtual void AbortFlow() OVERRIDE; 75 virtual void FinishFlow() OVERRIDE; 76 virtual void SelectPicture() OVERRIDE; 77 78 // LocallyManagedUserController::StatusConsumer overrides. 79 virtual void OnCreationError( 80 LocallyManagedUserCreationController::ErrorCode code) OVERRIDE; 81 virtual void OnCreationTimeout() OVERRIDE; 82 virtual void OnCreationSuccess() OVERRIDE; 83 84 // NetworkPortalDetector::Observer implementation: 85 virtual void OnPortalDetectionCompleted( 86 const NetworkState* network, 87 const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE; 88 private: 89 LocallyManagedUserCreationScreenHandler* actor_; 90 91 scoped_ptr<LocallyManagedUserCreationController> controller_; 92 93 bool on_error_screen_; 94 bool on_image_screen_; 95 96 DISALLOW_COPY_AND_ASSIGN(LocallyManagedUserCreationScreen); 97}; 98 99} // namespace chromeos 100 101#endif // CHROME_BROWSER_CHROMEOS_LOGIN_MANAGED_LOCALLY_MANAGED_USER_CREATION_SCREEN_H_ 102 103