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   };
     28 
     29   enum ErrorState {
     30     ERROR_STATE_UNKNOWN = 0,
     31     ERROR_STATE_PORTAL,
     32     ERROR_STATE_OFFLINE,
     33     ERROR_STATE_PROXY,
     34     ERROR_STATE_AUTH_EXT_TIMEOUT
     35   };
     36 
     37   ErrorScreen(ScreenObserver* screen_observer, ErrorScreenActor* actor);
     38   virtual ~ErrorScreen();
     39 
     40   // WizardScreen implementation.
     41   virtual void PrepareToShow() OVERRIDE;
     42   virtual void Show() OVERRIDE;
     43   virtual void Hide() OVERRIDE;
     44   virtual std::string GetName() const OVERRIDE;
     45 
     46   // Initializes captive portal dialog and shows that if needed.
     47   void FixCaptivePortal();
     48 
     49   // Shows captive portal dialog.
     50   void ShowCaptivePortal();
     51 
     52   // Hides captive portal dialog.
     53   void HideCaptivePortal();
     54 
     55   // Sets current UI state.
     56   void SetUIState(UIState ui_state);
     57 
     58   // Sets current error screen content according to current UI state,
     59   // |error_state|, and |network|.
     60   void SetErrorState(ErrorState error_state, const std::string& network);
     61 
     62   void set_parent_screen(OobeDisplay::Screen parent_screen) {
     63     parent_screen_ = parent_screen;
     64   }
     65   OobeDisplay::Screen parent_screen() const { return parent_screen_; }
     66 
     67  private:
     68   ErrorScreenActor* actor_;
     69 
     70   OobeDisplay::Screen parent_screen_;
     71 
     72   DISALLOW_COPY_AND_ASSIGN(ErrorScreen);
     73 };
     74 
     75 }  // namespace chromeos
     76 
     77 #endif  // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_H_
     78