Chromium Code Reviews| Index: chrome/browser/chromeos/login/screens/error_screen.h |
| diff --git a/chrome/browser/chromeos/login/screens/error_screen.h b/chrome/browser/chromeos/login/screens/error_screen.h |
| index 70f36f08ed483dcd61743360f84b4d5ff66b79c1..b9b26b42ff51dee7d685b3ceb0951dcdaeee5b67 100644 |
| --- a/chrome/browser/chromeos/login/screens/error_screen.h |
| +++ b/chrome/browser/chromeos/login/screens/error_screen.h |
| @@ -7,11 +7,12 @@ |
| #include <memory> |
| +#include "base/callback_list.h" |
| #include "base/compiler_specific.h" |
| #include "base/macros.h" |
| #include "base/memory/weak_ptr.h" |
| +#include "chrome/browser/chromeos/login/screens/base_screen.h" |
| #include "chrome/browser/chromeos/login/screens/network_error.h" |
| -#include "chrome/browser/chromeos/login/screens/network_error_model.h" |
| #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
| #include "chromeos/login/auth/login_performer.h" |
| @@ -23,38 +24,83 @@ class CaptivePortalWindowProxy; |
| class NetworkErrorView; |
| // Controller for the error screen. |
| -class ErrorScreen : public NetworkErrorModel, public LoginPerformer::Delegate { |
| +class ErrorScreen : public BaseScreen, public LoginPerformer::Delegate { |
| public: |
| - typedef std::unique_ptr<base::CallbackList<void()>::Subscription> |
| - ConnectRequestCallbackSubscription; |
| + using ConnectRequestCallbackSubscription = |
| + std::unique_ptr<base::CallbackList<void()>::Subscription>; |
| + |
| + // TODO(jdufault): Some of these are no longer used and can be removed. See |
| + // crbug.com/672142. |
| + static const char kUserActionConfigureCertsButtonClicked[]; |
| + static const char kUserActionDiagnoseButtonClicked[]; |
| + static const char kUserActionLaunchOobeGuestSessionClicked[]; |
| + static const char kUserActionLocalStateErrorPowerwashButtonClicked[]; |
| + static const char kUserActionRebootButtonClicked[]; |
| + static const char kUserActionShowCaptivePortalClicked[]; |
| + static const char kUserActionConnectRequested[]; |
| ErrorScreen(BaseScreenDelegate* base_screen_delegate, NetworkErrorView* view); |
| ~ErrorScreen() override; |
| - // NetworkErrorModel: |
| + // Toggles the guest sign-in prompt. |
| + void AllowGuestSignin(bool allowed); |
| + |
| + // Toggles the offline sign-in. |
| + void AllowOfflineLogin(bool allowed); |
| + |
| + // Initializes captive portal dialog and shows that if needed. |
| + virtual void FixCaptivePortal(); |
|
achuithb
2017/01/20 23:06:55
Why is this virtual?
jdufault
2017/01/25 00:51:34
It is overridden in a mock.
|
| + |
| + NetworkError::UIState GetUIState() const; |
| + NetworkError::ErrorState GetErrorState() const; |
| + |
| + // Returns id of the screen behind error screen ("caller" screen). |
| + // Returns OobeScreen::SCREEN_UNKNOWN if error screen isn't the current |
| + // screen. |
| + OobeScreen GetParentScreen() const; |
| + |
| + // Called when we're asked to hide captive portal dialog. |
| + void HideCaptivePortal(); |
| + |
| + // This method is called, when view is being destroyed. Note, if model |
| + // is destroyed earlier then it has to call Unbind(). |
| + void OnViewDestroyed(NetworkErrorView* view); |
| + |
| + // Sets current UI state. |
| + virtual void SetUIState(NetworkError::UIState ui_state); |
|
achuithb
2017/01/20 23:06:55
why is this virtual?
jdufault
2017/01/25 00:51:34
It is overridden in a mock.
|
| + |
| + // Sets current error screen content according to current UI state, |
| + // |error_state|, and |network|. |
| + virtual void SetErrorState(NetworkError::ErrorState error_state, |
|
achuithb
2017/01/20 23:06:55
why is this virtual?
jdufault
2017/01/25 00:51:34
It is overridden in a mock.
|
| + const std::string& network); |
| + |
| + // Sets "parent screen" i.e. one that has initiated this network error screen |
| + // instance. |
| + void SetParentScreen(OobeScreen parent_screen); |
| + |
| + // Sets callback that is called on hide. |
| + void SetHideCallback(const base::Closure& on_hide); |
| + |
| + // Shows captive portal dialog. |
| + void ShowCaptivePortal(); |
| + |
| + // Toggles the connection pending indicator. |
| + void ShowConnectingIndicator(bool show); |
| + |
| + // Register a callback to be invoked when the user indicates that an attempt |
| + // to connect to the network should be made. |
| + ConnectRequestCallbackSubscription RegisterConnectRequestCallback( |
| + const base::Closure& callback); |
| + |
| + // BaseScreen overrides: |
| void Show() override; |
| void Hide() override; |
| void OnShow() override; |
| void OnHide() override; |
| void OnUserAction(const std::string& action_id) override; |
| void OnContextKeyUpdated(const ::login::ScreenContext::KeyType& key) override; |
| - void AllowGuestSignin(bool allowed) override; |
| - void AllowOfflineLogin(bool allowed) override; |
| - void FixCaptivePortal() override; |
| - NetworkError::UIState GetUIState() const override; |
| - NetworkError::ErrorState GetErrorState() const override; |
| - OobeScreen GetParentScreen() const override; |
| - void HideCaptivePortal() override; |
| - void OnViewDestroyed(NetworkErrorView* view) override; |
| - void SetUIState(NetworkError::UIState ui_state) override; |
| - void SetErrorState(NetworkError::ErrorState error_state, |
| - const std::string& network) override; |
| - void SetParentScreen(OobeScreen parent_screen) override; |
| - void SetHideCallback(const base::Closure& on_hide) override; |
| - void ShowCaptivePortal() override; |
| - void ShowConnectingIndicator(bool show) override; |
| - |
| - // LoginPerformer::Delegate implementation: |
| + |
| + // LoginPerformer::Delegate overrides: |
| void OnAuthFailure(const AuthFailure& error) override; |
| void OnAuthSuccess(const UserContext& user_context) override; |
| void OnOffTheRecordAuthSuccess() override; |
| @@ -63,12 +109,6 @@ class ErrorScreen : public NetworkErrorModel, public LoginPerformer::Delegate { |
| void PolicyLoadFailed() override; |
| void SetAuthFlowOffline(bool offline) override; |
| - // Register a callback to be invoked when the user indicates that an attempt |
| - // to connect to the network should be made. |
| - ConnectRequestCallbackSubscription RegisterConnectRequestCallback( |
| - const base::Closure& callback); |
| - |
| - private: |
|
achuithb
2017/01/20 23:06:55
Looks like you dropped this.
jdufault
2017/01/25 00:51:34
Done.
|
| // Default hide_closure for Hide(). |
| void DefaultHideCallback(); |