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/screens/base_screen.h"
13 #include "chrome/browser/chromeos/login/screens/error_screen_actor_delegate.h"
14 #include "chrome/browser/chromeos/login/ui/oobe_display.h"
15 #include "chrome/browser/chromeos/settings/device_settings_service.h"
16 #include "chromeos/login/auth/login_performer.h"
20 class BaseScreenDelegate;
22 // Controller for the error screen.
23 class ErrorScreen : public BaseScreen,
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,
45 // States above are being logged to histograms.
46 // Please keep ERROR_STATE_NONE as the last one of the histogram values.
47 ERROR_STATE_KIOSK_ONLINE,
50 ErrorScreen(BaseScreenDelegate* base_screen_delegate,
51 ErrorScreenActor* actor);
52 virtual ~ErrorScreen();
54 // BaseScreen implementation.
55 virtual void PrepareToShow() override;
56 virtual void Show() override;
57 virtual void Hide() override;
58 virtual std::string GetName() const override;
60 // ErrorScreenActorDelegate implementation:
61 virtual void OnErrorShow() override;
62 virtual void OnErrorHide() override;
63 virtual void OnLaunchOobeGuestSession() override;
64 virtual void OnActorDestroyed() override;
66 // LoginPerformer::Delegate implementation:
67 virtual void OnAuthFailure(const AuthFailure& error) override;
68 virtual void OnAuthSuccess(const UserContext& user_context) override;
69 virtual void OnOffTheRecordAuthSuccess() override;
70 virtual void OnPasswordChangeDetected() override;
71 virtual void WhiteListCheckFailed(const std::string& email) override;
72 virtual void PolicyLoadFailed() override;
73 virtual void OnOnlineChecked(const std::string& username,
74 bool success) override;
76 // Initializes captive portal dialog and shows that if needed.
77 void FixCaptivePortal();
79 // Shows captive portal dialog.
80 void ShowCaptivePortal();
82 // Hides captive portal dialog.
83 void HideCaptivePortal();
85 // Sets current UI state.
86 void SetUIState(UIState ui_state);
88 UIState GetUIState() const;
90 // Sets current error screen content according to current UI state,
91 // |error_state|, and |network|.
92 void SetErrorState(ErrorState error_state, const std::string& network);
94 ErrorState GetErrorState() const;
96 // Toggles the guest sign-in prompt.
97 void AllowGuestSignin(bool allow);
99 // Toggles the connection pending indicator.
100 void ShowConnectingIndicator(bool show);
102 void set_parent_screen(OobeDisplay::Screen parent_screen) {
103 parent_screen_ = parent_screen;
105 OobeDisplay::Screen parent_screen() const { return parent_screen_; }
108 // Handles the response of an ownership check and starts the guest session if
110 void StartGuestSessionAfterOwnershipCheck(
111 DeviceSettingsService::OwnershipStatus ownership_status);
113 ErrorScreenActor* actor_;
115 OobeDisplay::Screen parent_screen_;
117 scoped_ptr<LoginPerformer> guest_login_performer_;
119 base::WeakPtrFactory<ErrorScreen> weak_factory_;
121 DISALLOW_COPY_AND_ASSIGN(ErrorScreen);
124 } // namespace chromeos
126 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_