| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/cancelable_callback.h" | 8 #include "base/macros.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "chrome/browser/chromeos/login/screens/network_error_view.h" |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "chrome/browser/chromeos/login/screens/error_screen_actor.h" | |
| 12 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" | 10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class DictionaryValue; | |
| 17 } | |
| 18 | 11 |
| 19 namespace chromeos { | 12 namespace chromeos { |
| 20 | 13 |
| 21 class CaptivePortalWindowProxy; | 14 class NetworkErrorModel; |
| 22 class NativeWindowDelegate; | |
| 23 class NetworkStateInformer; | |
| 24 | 15 |
| 25 // A class that handles the WebUI hooks in error screen. | 16 // A class that handles the WebUI hooks in error screen. |
| 26 class ErrorScreenHandler : public BaseScreenHandler, | 17 class ErrorScreenHandler : public BaseScreenHandler, public NetworkErrorView { |
| 27 public ErrorScreenActor { | |
| 28 public: | 18 public: |
| 29 ErrorScreenHandler( | 19 ErrorScreenHandler(); |
| 30 const scoped_refptr<NetworkStateInformer>& network_state_informer); | |
| 31 ~ErrorScreenHandler() override; | 20 ~ErrorScreenHandler() override; |
| 32 | 21 |
| 33 // ErrorScreenActor implementation: | 22 // ErrorView: |
| 34 void SetDelegate(ErrorScreenActorDelegate* delegate) override; | 23 void PrepareToShow() override; |
| 35 void Show(OobeDisplay::Screen parent_screen, | 24 void Show() override; |
| 36 base::DictionaryValue* params) override; | |
| 37 void Show(OobeDisplay::Screen parent_screen, | |
| 38 base::DictionaryValue* params, | |
| 39 const base::Closure& on_hide) override; | |
| 40 void Hide() override; | 25 void Hide() override; |
| 41 void FixCaptivePortal() override; | 26 void Bind(NetworkErrorModel& model) override; |
| 42 void ShowCaptivePortal() override; | 27 void Unbind() override; |
| 43 void HideCaptivePortal() override; | 28 void ShowScreen(OobeUI::Screen screen) override; |
| 44 void SetUIState(ErrorScreen::UIState ui_state) override; | |
| 45 void SetErrorState(ErrorScreen::ErrorState error_state, | |
| 46 const std::string& network) override; | |
| 47 void AllowGuestSignin(bool allowed) override; | |
| 48 void AllowOfflineLogin(bool allowed) override; | |
| 49 void ShowConnectingIndicator(bool show) override; | |
| 50 | 29 |
| 51 private: | 30 private: |
| 52 // Sends notification that error message is shown. | |
| 53 void NetworkErrorShown(); | |
| 54 | |
| 55 bool GetScreenName(OobeUI::Screen screen, std::string* name) const; | 31 bool GetScreenName(OobeUI::Screen screen, std::string* name) const; |
| 56 | 32 |
| 57 // Default hide_closure for Show/Hide. | |
| 58 void CheckAndShowScreen(); | |
| 59 | |
| 60 // WebUI message handlers. | 33 // WebUI message handlers. |
| 61 void HandleShowCaptivePortal(); | |
| 62 void HandleHideCaptivePortal(); | 34 void HandleHideCaptivePortal(); |
| 63 void HandleLocalStateErrorPowerwashButtonClicked(); | |
| 64 void HandleRebootButtonClicked(); | |
| 65 void HandleDiagnoseButtonClicked(); | |
| 66 void HandleConfigureCerts(); | |
| 67 void HandleLaunchOobeGuestSession(); | |
| 68 | 35 |
| 69 // WebUIMessageHandler implementation: | 36 // WebUIMessageHandler implementation: |
| 70 void RegisterMessages() override; | 37 void RegisterMessages() override; |
| 71 | 38 |
| 72 // BaseScreenHandler implementation: | 39 // BaseScreenHandler implementation: |
| 73 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; | 40 void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; |
| 74 void Initialize() override; | 41 void Initialize() override; |
| 75 | 42 |
| 76 // Non-owning ptr. | 43 // Non-owning ptr. |
| 77 ErrorScreenActorDelegate* delegate_; | 44 NetworkErrorModel* model_; |
| 78 | |
| 79 // Proxy which manages showing of the window for captive portal entering. | |
| 80 scoped_ptr<CaptivePortalWindowProxy> captive_portal_window_proxy_; | |
| 81 | |
| 82 // Network state informer used to keep error screen up. | |
| 83 scoped_refptr<NetworkStateInformer> network_state_informer_; | |
| 84 | |
| 85 // NativeWindowDelegate used to get reference to NativeWindow. | |
| 86 NativeWindowDelegate* native_window_delegate_; | |
| 87 | 45 |
| 88 // Keeps whether screen should be shown right after initialization. | 46 // Keeps whether screen should be shown right after initialization. |
| 89 bool show_on_init_; | 47 bool show_on_init_; |
| 90 | 48 |
| 91 scoped_ptr<base::Closure> on_hide_; | |
| 92 | |
| 93 base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_; | 49 base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_; |
| 94 | 50 |
| 95 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler); | 51 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler); |
| 96 }; | 52 }; |
| 97 | 53 |
| 98 } // namespace chromeos | 54 } // namespace chromeos |
| 99 | 55 |
| 100 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ | 56 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ |
| OLD | NEW |