#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_ENROLLMENT_SCREEN_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/login/enrollment/enrollment_screen_actor.h"
#include "chrome/browser/chromeos/login/screens/wizard_screen.h"
#include "components/policy/core/common/cloud/cloud_policy_constants.h"
namespace chromeos {
class ScreenObserver;
class EnrollmentScreen
: public WizardScreen,
public EnrollmentScreenActor::Controller {
public:
EnrollmentScreen(ScreenObserver* observer,
EnrollmentScreenActor* actor);
virtual ~EnrollmentScreen();
void SetParameters(EnrollmentScreenActor::EnrollmentMode enrollment_mode,
const std::string& management_domain,
const std::string& enrollment_user);
virtual void PrepareToShow() OVERRIDE;
virtual void Show() OVERRIDE;
virtual void Hide() OVERRIDE;
virtual std::string GetName() const OVERRIDE;
virtual void OnLoginDone(const std::string& user) OVERRIDE;
virtual void OnAuthError(const GoogleServiceAuthError& error) OVERRIDE;
virtual void OnOAuthTokenAvailable(const std::string& oauth_token) OVERRIDE;
virtual void OnRetry() OVERRIDE;
virtual void OnCancel() OVERRIDE;
virtual void OnConfirmationClosed() OVERRIDE;
EnrollmentScreenActor* GetActor() {
return actor_;
}
private:
void WriteInstallAttributesData();
void RegisterForDevicePolicy(const std::string& token);
void ReportEnrollmentStatus(policy::EnrollmentStatus status);
void UMAFailure(int sample);
void ShowSigninScreen();
bool is_auto_enrollment() const {
return enrollment_mode_ == EnrollmentScreenActor::ENROLLMENT_MODE_AUTO;
}
EnrollmentScreenActor* actor_;
EnrollmentScreenActor::EnrollmentMode enrollment_mode_;
bool enrollment_failed_once_;
std::string user_;
int lockbox_init_duration_;
base::WeakPtrFactory<EnrollmentScreen> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(EnrollmentScreen);
};
}
#endif