Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/error_screen_handler.h

Issue 872633008: Migrate (Network)ErrorScreen to ScreenContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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( 40 void DeclareLocalizedValues(
74 ::login::LocalizedValuesBuilder* builder) override; 41 ::login::LocalizedValuesBuilder* builder) override;
75 void Initialize() override; 42 void Initialize() override;
76 43
77 // Non-owning ptr. 44 // Non-owning ptr.
78 ErrorScreenActorDelegate* delegate_; 45 NetworkErrorModel* model_;
79
80 // Proxy which manages showing of the window for captive portal entering.
81 scoped_ptr<CaptivePortalWindowProxy> captive_portal_window_proxy_;
82
83 // Network state informer used to keep error screen up.
84 scoped_refptr<NetworkStateInformer> network_state_informer_;
85
86 // NativeWindowDelegate used to get reference to NativeWindow.
87 NativeWindowDelegate* native_window_delegate_;
88 46
89 // Keeps whether screen should be shown right after initialization. 47 // Keeps whether screen should be shown right after initialization.
90 bool show_on_init_; 48 bool show_on_init_;
91 49
92 scoped_ptr<base::Closure> on_hide_;
93
94 base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_; 50 base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_;
95 51
96 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler); 52 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler);
97 }; 53 };
98 54
99 } // namespace chromeos 55 } // namespace chromeos
100 56
101 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_ 57 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698