Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ui / webui / chromeos / login / enable_debugging_screen_handler.h
bloba36b1d490b58c819a570e9499b96dbc0183b23ae
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_ENABLE_DEBUGGING_SCREEN_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENABLE_DEBUGGING_SCREEN_HANDLER_H_
8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "chrome/browser/chromeos/login/help_app_launcher.h"
12 #include "chrome/browser/chromeos/login/screens/enable_debugging_screen_actor.h"
13 #include "chrome/browser/ui/webui/chromeos/login/base_screen_handler.h"
15 class PrefRegistrySimple;
17 namespace chromeos {
19 // WebUI implementation of EnableDebuggingScreenActor.
20 class EnableDebuggingScreenHandler : public EnableDebuggingScreenActor,
21 public BaseScreenHandler {
22 public:
23 EnableDebuggingScreenHandler();
24 ~EnableDebuggingScreenHandler() override;
26 // EnableDebuggingScreenActor implementation:
27 void PrepareToShow() override;
28 void Show() override;
29 void Hide() override;
30 void SetDelegate(Delegate* delegate) override;
32 // BaseScreenHandler implementation:
33 void DeclareLocalizedValues(
34 ::login::LocalizedValuesBuilder* builder) override;
35 void Initialize() override;
37 // WebUIMessageHandler implementation:
38 void RegisterMessages() override;
40 // Registers Local State preferences.
41 static void RegisterPrefs(PrefRegistrySimple* registry);
43 private:
44 enum UIState {
45 UI_STATE_ERROR = -1,
46 UI_STATE_REMOVE_PROTECTION = 1,
47 UI_STATE_SETUP = 2,
48 UI_STATE_WAIT = 3,
49 UI_STATE_DONE = 4,
52 // JS messages handlers.
53 void HandleOnCancel();
54 void HandleOnDone();
55 void HandleOnLearnMore();
56 void HandleOnRemoveRootFSProtection();
57 void HandleOnSetup(const std::string& password);
59 void ShowWithParams();
61 // Callback for CryptohomeClient::WaitForServiceToBeAvailable
62 void OnCryptohomeDaemonAvailabilityChecked(bool service_is_available);
64 // Callback for DebugDaemonClient::WaitForServiceToBeAvailable
65 void OnDebugDaemonServiceAvailabilityChecked(bool service_is_available);
67 // Callback for DebugDaemonClient::EnableDebuggingFeatures().
68 void OnEnableDebuggingFeatures(bool success);
70 // Callback for DebugDaemonClient::QueryDebuggingFeatures().
71 void OnQueryDebuggingFeatures(bool success, int features_flag);
73 // Callback for DebugDaemonClient::RemoveRootfsVerification().
74 void OnRemoveRootfsVerification(bool success);
76 // Updates UI state.
77 void UpdateUIState(UIState state);
79 Delegate* delegate_;
81 // Keeps whether screen should be shown right after initialization.
82 bool show_on_init_;
84 base::WeakPtrFactory<EnableDebuggingScreenHandler> weak_ptr_factory_;
86 DISALLOW_COPY_AND_ASSIGN(EnableDebuggingScreenHandler);
89 } // namespace chromeos
91 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENABLE_DEBUGGING_SCREEN_HANDLER_H_