Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / error_screen_handler.h
blob65119ee079d950f3ea84fda44aac816c9d85f85d
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/macros.h"
9 #include "chrome/browser/chromeos/login/screens/network_error_view.h"
10 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
11 #include "chrome/browser/ui/webui/chromeos/login/network_dropdown_handler.h"
13 namespace chromeos {
15 class NetworkErrorModel;
17 // A class that handles the WebUI hooks in error screen.
18 class ErrorScreenHandler : public BaseScreenHandler,
19 public NetworkErrorView,
20 public NetworkDropdownHandler::Observer {
21 public:
22 ErrorScreenHandler();
23 ~ErrorScreenHandler() override;
25 // ErrorView:
26 void PrepareToShow() override;
27 void Show() override;
28 void Hide() override;
29 void Bind(NetworkErrorModel& model) override;
30 void Unbind() override;
31 void ShowScreen(OobeUI::Screen screen) override;
33 private:
34 bool GetScreenName(OobeUI::Screen screen, std::string* name) const;
36 // WebUI message handlers.
37 void HandleHideCaptivePortal();
39 // WebUIMessageHandler implementation:
40 void RegisterMessages() override;
42 // BaseScreenHandler implementation:
43 void DeclareLocalizedValues(
44 ::login::LocalizedValuesBuilder* builder) override;
45 void Initialize() override;
47 // NetworkDropdownHandler:
48 void OnConnectToNetworkRequested() override;
50 // Non-owning ptr.
51 NetworkErrorModel* model_;
53 // Keeps whether screen should be shown right after initialization.
54 bool show_on_init_;
56 // Whether the error screen is currently shown.
57 bool showing_;
59 base::WeakPtrFactory<ErrorScreenHandler> weak_ptr_factory_;
61 DISALLOW_COPY_AND_ASSIGN(ErrorScreenHandler);
64 } // namespace chromeos
66 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ERROR_SCREEN_HANDLER_H_