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 <string> 9 10 #include "base/basictypes.h" 11 #include "chrome/browser/chromeos/login/screens/error_screen.h" 12 #include "chrome/browser/chromeos/login/screens/error_screen_actor_delegate.h" 13 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" 14 15 namespace base { 16 class DictionaryValue; 17 } 18 19 namespace chromeos { 20 21 class ErrorScreenActor { 22 public: 23 // Possible network error reasons. 24 enum ErrorReason { 25 ERROR_REASON_PROXY_AUTH_CANCELLED = 0, 26 ERROR_REASON_PROXY_AUTH_SUPPLIED, 27 ERROR_REASON_PROXY_CONNECTION_FAILED, 28 ERROR_REASON_PROXY_CONFIG_CHANGED, 29 ERROR_REASON_LOADING_TIMEOUT, 30 ERROR_REASON_PORTAL_DETECTED, 31 // Reason for a case when default network has changed. 32 ERROR_REASON_NETWORK_STATE_CHANGED, 33 // Reason for a case when JS side requires error screen update. 34 ERROR_REASON_UPDATE, 35 ERROR_REASON_FRAME_ERROR 36 }; 37 38 ErrorScreenActor(); 39 virtual ~ErrorScreenActor(); 40 ui_state()41 ErrorScreen::UIState ui_state() const { return ui_state_; } error_state()42 ErrorScreen::ErrorState error_state() const { return error_state_; } 43 44 // Returns id of the screen behind error screen ("caller" screen). 45 // Returns OobeUI::SCREEN_UNKNOWN if error screen isn't the current 46 // screen. parent_screen()47 OobeUI::Screen parent_screen() const { return parent_screen_; } 48 49 // Sets screen this actor belongs to. 50 virtual void SetDelegate(ErrorScreenActorDelegate* delegate) = 0; 51 52 // Shows the screen. 53 virtual void Show(OobeDisplay::Screen parent_screen, 54 base::DictionaryValue* params) = 0; 55 56 // Shows the screen and call |on_hide| on hide. 57 virtual void Show(OobeDisplay::Screen parent_screen, 58 base::DictionaryValue* params, 59 const base::Closure& on_hide) = 0; 60 61 // Hides the screen. 62 virtual void Hide() = 0; 63 64 // Initializes captive portal dialog and shows that if needed. 65 virtual void FixCaptivePortal() = 0; 66 67 // Shows captive portal dialog. 68 virtual void ShowCaptivePortal() = 0; 69 70 // Hides captive portal dialog. 71 virtual void HideCaptivePortal() = 0; 72 73 virtual void SetUIState(ErrorScreen::UIState ui_state) = 0; 74 virtual void SetErrorState(ErrorScreen::ErrorState error_state, 75 const std::string& network) = 0; 76 77 virtual void AllowGuestSignin(bool allowed) = 0; 78 virtual void AllowOfflineLogin(bool allowed) = 0; 79 80 virtual void ShowConnectingIndicator(bool show) = 0; 81 82 static const char* ErrorReasonString(ErrorReason reason); 83 84 protected: 85 ErrorScreen::UIState ui_state_; 86 ErrorScreen::ErrorState error_state_; 87 std::string network_; 88 bool guest_signin_allowed_; 89 bool offline_login_allowed_; 90 bool show_connecting_indicator_; 91 92 OobeUI::Screen parent_screen_; 93 94 DISALLOW_COPY_AND_ASSIGN(ErrorScreenActor); 95 }; 96 97 } // namespace chromeos 98 99 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_ERROR_SCREEN_ACTOR_H_ 100