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