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_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
10 #include "base/basictypes.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h"
14 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
15 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 // The screen implementation that links the enterprise enrollment UI into the
23 class EnrollmentScreen
24 : public WizardScreen
,
25 public EnrollmentScreenActor::Controller
{
27 EnrollmentScreen(ScreenObserver
* observer
,
28 EnrollmentScreenActor
* actor
);
29 virtual ~EnrollmentScreen();
31 void SetParameters(bool is_auto_enrollment
,
32 bool can_exit_enrollment
,
33 const std::string
& enrollment_user
);
35 // WizardScreen implementation:
36 virtual void PrepareToShow() OVERRIDE
;
37 virtual void Show() OVERRIDE
;
38 virtual void Hide() OVERRIDE
;
39 virtual std::string
GetName() const OVERRIDE
;
41 // EnrollmentScreenActor::Controller implementation:
42 virtual void OnLoginDone(const std::string
& user
) OVERRIDE
;
43 virtual void OnAuthError(const GoogleServiceAuthError
& error
) OVERRIDE
;
44 virtual void OnOAuthTokenAvailable(const std::string
& oauth_token
) OVERRIDE
;
45 virtual void OnRetry() OVERRIDE
;
46 virtual void OnCancel() OVERRIDE
;
47 virtual void OnConfirmationClosed() OVERRIDE
;
50 EnrollmentScreenActor
* GetActor() {
55 // Starts the Lockbox storage process.
56 void WriteInstallAttributesData();
58 // Kicks off the policy infrastructure to register with the service.
59 void RegisterForDevicePolicy(const std::string
& token
);
61 // Handles enrollment completion. Logs a UMA sample and requests the actor to
62 // show the specified enrollment status.
63 void ReportEnrollmentStatus(policy::EnrollmentStatus status
);
65 // Logs a UMA event in the kMetricEnrollment histogram. If auto-enrollment is
66 // on |sample| is ignored and a kMetricEnrollmentAutoFailed sample is logged
68 void UMAFailure(int sample
);
70 // Shows the signin screen. Used as a callback to run after auth reset.
71 void ShowSigninScreen();
73 EnrollmentScreenActor
* actor_
;
74 bool is_auto_enrollment_
;
75 bool can_exit_enrollment_
;
76 bool enrollment_failed_once_
;
78 int lockbox_init_duration_
;
79 base::WeakPtrFactory
<EnrollmentScreen
> weak_ptr_factory_
;
81 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen
);
84 } // namespace chromeos
86 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_