Home | History | Annotate | Download | only in screens
      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.
      4 
      5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
      6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "chrome/browser/chromeos/login/oobe_display.h"
     11 #include "chrome/browser/chromeos/login/oobe_display.h"
     12 #include "chrome/browser/chromeos/login/screens/wizard_screen.h"
     13 
     14 namespace chromeos {
     15 
     16 class ErrorScreenActor;
     17 class ScreenObserver;
     18 
     19 // Controller for the error screen.
     20 class ErrorScreen : public WizardScreen {
     21  public:
     22   enum UIState {
     23     UI_STATE_UNKNOWN = 0,
     24     UI_STATE_UPDATE,
     25     UI_STATE_SIGNIN,
     26     UI_STATE_LOCALLY_MANAGED,
     27     UI_STATE_KIOSK_MODE,
     28     UI_STATE_LOCAL_STATE_ERROR
     29   };
     30 
     31   enum ErrorState {
     32     ERROR_STATE_UNKNOWN = 0,
     33     ERROR_STATE_PORTAL,
     34     ERROR_STATE_OFFLINE,
     35     ERROR_STATE_PROXY,
     36     ERROR_STATE_AUTH_EXT_TIMEOUT
     37   };
     38 
     39   ErrorScreen(ScreenObserver* screen_observer, ErrorScreenActor* actor);
     40   virtual ~ErrorScreen();
     41 
     42   // WizardScreen implementation.
     43   virtual void PrepareToShow() OVERRIDE;
     44   virtual void Show() OVERRIDE;
     45   virtual void Hide() OVERRIDE;
     46   virtual std::string GetName() const OVERRIDE;
     47 
     48   // Initializes captive portal dialog and shows that if needed.
     49   void FixCaptivePortal();
     50 
     51   // Shows captive portal dialog.
     52   void ShowCaptivePortal();
     53 
     54   // Hides captive portal dialog.
     55   void HideCaptivePortal();
     56 
     57   // Sets current UI state.
     58   void SetUIState(UIState ui_state);
     59 
     60   UIState GetUIState() const;
     61 
     62   // Sets current error screen content according to current UI state,
     63   // |error_state|, and |network|.
     64   void SetErrorState(ErrorState error_state, const std::string& network);
     65 
     66   void set_parent_screen(OobeDisplay::Screen parent_screen) {
     67     parent_screen_ = parent_screen;
     68   }
     69   OobeDisplay::Screen parent_screen() const { return parent_screen_; }
     70 
     71  private:
     72   ErrorScreenActor* actor_;
     73 
     74   OobeDisplay::Screen parent_screen_;
     75 
     76   DISALLOW_COPY_AND_ASSIGN(ErrorScreen);
     77 };
     78 
     79 }  // namespace chromeos
     80 
     81 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
     82