OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_NETWORK_ERROR_MODEL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_ERROR_MODEL_H_ |
| 7 |
| 8 #include "base/memory/ref_counted.h" |
| 9 #include "chrome/browser/chromeos/login/screens/base_screen.h" |
| 10 #include "chrome/browser/chromeos/login/screens/network_error.h" |
| 11 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
| 12 |
| 13 namespace base { |
| 14 class ListValue; |
| 15 } |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 class BaseScreenDelegate; |
| 20 class NetworkErrorView; |
| 21 |
| 22 class NetworkErrorModel : public BaseScreen { |
| 23 public: |
| 24 static const char kContextKeyErrorStateCode[]; |
| 25 static const char kContextKeyErrorStateNetwork[]; |
| 26 static const char kContextKeyGuestSigninAllowed[]; |
| 27 static const char kContextKeyOfflineSigninAllowed[]; |
| 28 static const char kContextKeyShowConnectingIndicator[]; |
| 29 static const char kContextKeyUIState[]; |
| 30 static const char kUserActionConfigureCertsButtonClicked[]; |
| 31 static const char kUserActionDiagnoseButtonClicked[]; |
| 32 static const char kUserActionLaunchOobeGuestSessionClicked[]; |
| 33 static const char kUserActionLocalStateErrorPowerwashButtonClicked[]; |
| 34 static const char kUserActionRebootButtonClicked[]; |
| 35 static const char kUserActionShowCaptivePortalClicked[]; |
| 36 |
| 37 explicit NetworkErrorModel(BaseScreenDelegate* base_screen_delegate); |
| 38 ~NetworkErrorModel() override; |
| 39 |
| 40 // BaseScreen: |
| 41 std::string GetName() const override; |
| 42 |
| 43 // Toggles the guest sign-in prompt. |
| 44 virtual void AllowGuestSignin(bool allowed) = 0; |
| 45 |
| 46 // Toggles the offline sign-in. |
| 47 virtual void AllowOfflineLogin(bool allowed) = 0; |
| 48 |
| 49 // Initializes captive portal dialog and shows that if needed. |
| 50 virtual void FixCaptivePortal() = 0; |
| 51 |
| 52 virtual NetworkError::UIState GetUIState() const = 0; |
| 53 virtual NetworkError::ErrorState GetErrorState() const = 0; |
| 54 |
| 55 // Returns id of the screen behind error screen ("caller" screen). |
| 56 // Returns OobeUI::SCREEN_UNKNOWN if error screen isn't the current |
| 57 // screen. |
| 58 virtual OobeUI::Screen GetParentScreen() const = 0; |
| 59 |
| 60 // Called when we're asked to hide captive portal dialog. |
| 61 virtual void HideCaptivePortal() = 0; |
| 62 |
| 63 // This method is called, when view is being destroyed. Note, if model |
| 64 // is destroyed earlier then it has to call Unbind(). |
| 65 virtual void OnViewDestroyed(NetworkErrorView* view) = 0; |
| 66 |
| 67 // Sets current UI state. |
| 68 virtual void SetUIState(NetworkError::UIState ui_state) = 0; |
| 69 |
| 70 // Sets current error screen content according to current UI state, |
| 71 // |error_state|, and |network|. |
| 72 virtual void SetErrorState(NetworkError::ErrorState error_state, |
| 73 const std::string& network) = 0; |
| 74 |
| 75 // Sets "parent screen" i.e. one that has initiated this network error screen |
| 76 // instance. |
| 77 virtual void SetParentScreen(OobeUI::Screen parent_screen) = 0; |
| 78 |
| 79 // Sets callback that is called on hide. |
| 80 virtual void SetHideCallback(const base::Closure& on_hide) = 0; |
| 81 |
| 82 // Shows captive portal dialog. |
| 83 virtual void ShowCaptivePortal() = 0; |
| 84 |
| 85 // Toggles the connection pending indicator. |
| 86 virtual void ShowConnectingIndicator(bool show) = 0; |
| 87 }; |
| 88 |
| 89 } // namespace chromeos |
| 90 |
| 91 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SCREENS_NETWORK_ERROR_MODEL_H_ |
OLD | NEW |