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
;
19 // WebUI implementation of EnableDebuggingScreenActor.
20 class EnableDebuggingScreenHandler
: public EnableDebuggingScreenActor
,
21 public BaseScreenHandler
{
23 EnableDebuggingScreenHandler();
24 ~EnableDebuggingScreenHandler() override
;
26 // EnableDebuggingScreenActor implementation:
27 void PrepareToShow() 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
);
46 UI_STATE_REMOVE_PROTECTION
= 1,
52 // JS messages handlers.
53 void HandleOnCancel();
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
);
77 void UpdateUIState(UIState state
);
81 // Keeps whether screen should be shown right after initialization.
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_