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_SCREENS_ERROR_SCREEN_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/chromeos/login/auth/login_performer.h"
13 #include "chrome/browser/chromeos/login/screens/error_screen_actor_delegate.h"
14 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
15 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
16 #include "chrome/browser/chromeos/settings/device_settings_service.h"
22 // Controller for the error screen.
23 class ErrorScreen : public WizardScreen,
24 public ErrorScreenActorDelegate,
25 public LoginPerformer::Delegate {
33 UI_STATE_LOCAL_STATE_ERROR,
34 UI_STATE_AUTO_ENROLLMENT_ERROR,
35 UI_STATE_ROLLBACK_ERROR,
39 ERROR_STATE_UNKNOWN = 0,
43 ERROR_STATE_AUTH_EXT_TIMEOUT,
44 ERROR_STATE_KIOSK_ONLINE
47 ErrorScreen(ScreenObserver* screen_observer, ErrorScreenActor* actor);
48 virtual ~ErrorScreen();
50 // WizardScreen implementation.
51 virtual void PrepareToShow() OVERRIDE;
52 virtual void Show() OVERRIDE;
53 virtual void Hide() OVERRIDE;
54 virtual std::string GetName() const OVERRIDE;
56 // ErrorScreenActorDelegate implementation:
57 virtual void OnErrorShow() OVERRIDE;
58 virtual void OnErrorHide() OVERRIDE;
59 virtual void OnLaunchOobeGuestSession() OVERRIDE;
61 // LoginPerformer::Delegate implementation:
62 virtual void OnAuthFailure(const AuthFailure& error) OVERRIDE;
63 virtual void OnAuthSuccess(const UserContext& user_context) OVERRIDE;
64 virtual void OnOffTheRecordAuthSuccess() OVERRIDE;
65 virtual void OnPasswordChangeDetected() OVERRIDE;
66 virtual void WhiteListCheckFailed(const std::string& email) OVERRIDE;
67 virtual void PolicyLoadFailed() OVERRIDE;
68 virtual void OnOnlineChecked(const std::string& username,
69 bool success) OVERRIDE;
71 // Initializes captive portal dialog and shows that if needed.
72 void FixCaptivePortal();
74 // Shows captive portal dialog.
75 void ShowCaptivePortal();
77 // Hides captive portal dialog.
78 void HideCaptivePortal();
80 // Sets current UI state.
81 void SetUIState(UIState ui_state);
83 UIState GetUIState() const;
85 // Sets current error screen content according to current UI state,
86 // |error_state|, and |network|.
87 void SetErrorState(ErrorState error_state, const std::string& network);
89 // Toggles the guest sign-in prompt.
90 void AllowGuestSignin(bool allow);
92 // Toggles the connection pending indicator.
93 void ShowConnectingIndicator(bool show);
95 void set_parent_screen(OobeDisplay::Screen parent_screen) {
96 parent_screen_ = parent_screen;
98 OobeDisplay::Screen parent_screen() const { return parent_screen_; }
101 // Handles the response of an ownership check and starts the guest session if
103 void StartGuestSessionAfterOwnershipCheck(
104 DeviceSettingsService::OwnershipStatus ownership_status);
106 void* volatile canary_1_; // For debugging of https://crbug.com/396557.
107 ErrorScreenActor* actor_;
108 void* volatile canary_2_;
110 OobeDisplay::Screen parent_screen_;
112 scoped_ptr<LoginPerformer> guest_login_performer_;
114 base::WeakPtrFactory<ErrorScreen> weak_factory_;
116 DISALLOW_COPY_AND_ASSIGN(ErrorScreen);
119 } // namespace chromeos
121 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_