#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_
#define CHROME_BROWSER_CHROMEOS_LOGIN_ENROLLMENT_AUTO_ENROLLMENT_CHECK_STEP_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h"
#include "chrome/browser/chromeos/login/screens/error_screen.h"
#include "chrome/browser/chromeos/net/network_portal_detector.h"
namespace chromeos {
class ScreenObserver;
class AutoEnrollmentCheckStep : NetworkPortalDetector::Observer {
public:
AutoEnrollmentCheckStep(ScreenObserver* screen_observer,
AutoEnrollmentController* auto_enrollment_controller);
virtual ~AutoEnrollmentCheckStep();
void Start();
virtual void OnPortalDetectionCompleted(
const NetworkState* network,
const NetworkPortalDetector::CaptivePortalState& state) OVERRIDE;
private:
void OnAutoEnrollmentCheckProgressed(policy::AutoEnrollmentState state);
void UpdateState(
NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status,
policy::AutoEnrollmentState new_auto_enrollment_state);
bool UpdateCaptivePortalStatus(
NetworkPortalDetector::CaptivePortalStatus new_captive_portal_status);
bool UpdateAutoEnrollmentState(
policy::AutoEnrollmentState auto_enrollment_state);
void ShowErrorScreen(ErrorScreen::ErrorState error_state);
void SignalCompletion();
ScreenObserver* screen_observer_;
AutoEnrollmentController* auto_enrollment_controller_;
scoped_ptr<AutoEnrollmentController::ProgressCallbackList::Subscription>
auto_enrollment_progress_subscription_;
NetworkPortalDetector::CaptivePortalStatus captive_portal_status_;
policy::AutoEnrollmentState auto_enrollment_state_;
DISALLOW_COPY_AND_ASSIGN(AutoEnrollmentCheckStep);
};
}
#endif