error_screen_actor.h revision c2e0dbddbe15c98d52c4786dac06cb8952a8ae6d
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_ACTOR_H_ 6#define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_ACTOR_H_ 7 8#include "chrome/browser/chromeos/cros/network_constants.h" 9#include "chrome/browser/chromeos/login/screens/error_screen.h" 10#include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 11 12namespace base { 13class DictionaryValue; 14} 15 16namespace chromeos { 17 18class ErrorScreenActor { 19 public: 20 // Possible error reasons. 21 static const char kErrorReasonProxyAuthCancelled[]; 22 static const char kErrorReasonProxyAuthSupplied[]; 23 static const char kErrorReasonProxyConnectionFailed[]; 24 static const char kErrorReasonProxyConfigChanged[]; 25 static const char kErrorReasonLoadingTimeout[]; 26 static const char kErrorReasonPortalDetected[]; 27 // Reason for a case when network manager notifies about network 28 // change. 29 static const char kErrorReasonNetworkChanged[]; 30 // Reason for a case when JS side requires error screen update. 31 static const char kErrorReasonUpdate[]; 32 33 ErrorScreenActor(); 34 virtual ~ErrorScreenActor(); 35 36 ErrorScreen::UIState ui_state() const { return ui_state_; } 37 ErrorScreen::ErrorState error_state() const { return error_state_; } 38 39 // Returns id of the screen behind error screen ("caller" screen). 40 // Returns OobeUI::SCREEN_UNKNOWN if error screen isn't the current 41 // screen. 42 OobeUI::Screen parent_screen() const { return parent_screen_; } 43 44 // Shows the screen. 45 virtual void Show(OobeDisplay::Screen parent_screen, 46 base::DictionaryValue* params) = 0; 47 48 // Hides the screen. 49 virtual void Hide() = 0; 50 51 // Initializes captive portal dialog and shows that if needed. 52 virtual void FixCaptivePortal() = 0; 53 54 // Shows captive portal dialog. 55 virtual void ShowCaptivePortal() = 0; 56 57 // Hides captive portal dialog. 58 virtual void HideCaptivePortal() = 0; 59 60 virtual void SetUIState(ErrorScreen::UIState ui_state) = 0; 61 virtual void SetErrorState(ErrorScreen::ErrorState error_state, 62 const std::string& network) = 0; 63 64 virtual void AllowGuestSignin(bool allowed) = 0; 65 virtual void AllowOfflineLogin(bool allowed) = 0; 66 67 protected: 68 ErrorScreen::UIState ui_state_; 69 ErrorScreen::ErrorState error_state_; 70 OobeUI::Screen parent_screen_; 71}; 72 73} // namespace chromeos 74 75#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_ACTOR_H_ 76