NaCl: Update revision in DEPS, r12770 -> r12773
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / error_screen_handler.h
blobe95d326ccb7617e8134c24a9256c6bd5fba8e357
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.
5 #ifndef CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_
8 #include "base/cancelable_callback.h"
9 #include "base/compiler_specific.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"
13 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h"
15 namespace base {
16 class DictionaryValue;
19 namespace chromeos {
21 class CaptivePortalWindowProxy;
22 class NativeWindowDelegate;
23 class NetworkStateInformer;
25 // A class that handles the WebUI hooks in error screen.
26 class ErrorScreenHandler : public BaseScreenHandler,
27 public ErrorScreenActor {
28 public:
29 ErrorScreenHandler(
30 const scoped_refptr<NetworkStateInformer>& network_state_informer);
31 virtual ~ErrorScreenHandler();
33 // ErrorScreenActor implementation:
34 virtual void Show(OobeDisplay::Screen parent_screen,
35 base::DictionaryValue* params) OVERRIDE;
36 virtual void Hide() OVERRIDE;
37 virtual void FixCaptivePortal() OVERRIDE;
38 virtual void ShowCaptivePortal() OVERRIDE;
39 virtual void HideCaptivePortal() OVERRIDE;
40 virtual void SetUIState(ErrorScreen::UIState ui_state) OVERRIDE;
41 virtual void SetErrorState(ErrorScreen::ErrorState error_state,
42 const std::string& network) OVERRIDE;
43 virtual void AllowGuestSignin(bool allowed) OVERRIDE;
44 virtual void AllowOfflineLogin(bool allowed) OVERRIDE;
46 private:
47 // Sends notification that error message is shown.
48 void NetworkErrorShown();
50 bool GetScreenName(OobeUI::Screen screen, std::string* name) const;
52 // WebUI message handlers.
53 void HandleShowCaptivePortal();
54 void HandleHideCaptivePortal();
55 void HandleLocalStateErrorPowerwashButtonClicked();
56 void HandleRebootButtonClicked();
57 void HandleDiagnoseButtonClicked();
59 // WebUIMessageHandler implementation:
60 virtual void RegisterMessages() OVERRIDE;
62 // BaseScreenHandler implementation:
63 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) OVERRIDE;
64 virtual void Initialize() OVERRIDE;
66 // Proxy which manages showing of the window for captive portal entering.
67 scoped_ptr<CaptivePortalWindowProxy> captive_portal_window_proxy_;
69 // Network state informer used to keep error screen up.
70 scoped_refptr<NetworkStateInformer> network_state_informer_;
72 // NativeWindowDelegate used to get reference to NativeWindow.
73 NativeWindowDelegate* native_window_delegate_;
75 // Keeps whether screen should be shown right after initialization.
76 bool show_on_init_;
78 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler);
81 } // namespace chromeos
83 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_