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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_
10 #include "base/basictypes.h"
11 #include "base/callback_forward.h"
12 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
14 class GoogleServiceAuthError
;
18 // Interface class for the enterprise enrollment screen actor.
19 class EnrollmentScreenActor
{
21 // Enumeration of the possible errors that can occur during enrollment which
22 // are not covered by GoogleServiceAuthError or EnrollmentStatus.
24 // Existing enrollment domain doesn't match authentication user.
25 UI_ERROR_DOMAIN_MISMATCH
,
26 // Requested device mode not supported with auto enrollment.
27 UI_ERROR_AUTO_ENROLLMENT_BAD_MODE
,
28 // Unexpected error condition, indicates a bug in the code.
32 // This defines the interface for controllers which will be called back when
33 // something happens on the UI.
36 virtual ~Controller() {}
38 virtual void OnLoginDone(const std::string
& user
) = 0;
39 virtual void OnAuthError(const GoogleServiceAuthError
& error
) = 0;
40 virtual void OnOAuthTokenAvailable(const std::string
& oauth_token
) = 0;
41 virtual void OnRetry() = 0;
42 virtual void OnCancel() = 0;
43 virtual void OnConfirmationClosed() = 0;
46 virtual ~EnrollmentScreenActor() {}
48 // Initializes the actor with parameters.
49 virtual void SetParameters(Controller
* controller
,
50 bool is_auto_enrollment
,
51 bool can_exit_enrollment
,
52 const std::string
& user
) = 0;
54 // Prepare the contents to showing.
55 virtual void PrepareToShow() = 0;
57 // Shows the contents of the screen.
58 virtual void Show() = 0;
60 // Hides the contents of the screen.
61 virtual void Hide() = 0;
63 // Starts fetching the OAuth token.
64 virtual void FetchOAuthToken() = 0;
66 // Resets the authentication state and invokes the passed callback on
68 virtual void ResetAuth(const base::Closure
& callback
) = 0;
70 // Shows the signin screen.
71 virtual void ShowSigninScreen() = 0;
73 // Shows the spinner screen for enrollment.
74 virtual void ShowEnrollmentSpinnerScreen() = 0;
76 // Shows the spinner screen for login after auto-enrollment.
77 virtual void ShowLoginSpinnerScreen() = 0;
79 // Show an authentication error.
80 virtual void ShowAuthError(const GoogleServiceAuthError
& error
) = 0;
82 // Show non-authentication error.
83 virtual void ShowUIError(UIError error
) = 0;
85 // Update the UI to report the |status| of the enrollment procedure.
86 virtual void ShowEnrollmentStatus(policy::EnrollmentStatus status
) = 0;
88 // Used for testing only.
89 virtual void SubmitTestCredentials(const std::string
& email
,
90 const std::string
& password
) = 0;
93 } // namespace chromeos
95 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_ACTOR_H_