OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 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
_ |
| 7 |
| 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" |
| 14 |
| 15 class PrefRegistrySimple; |
| 16 |
| 17 namespace chromeos { |
| 18 |
| 19 // WebUI implementation of EnableDebuggingScreenActor. |
| 20 class EnableDebuggingScreenHandler : public EnableDebuggingScreenActor, |
| 21 public BaseScreenHandler { |
| 22 public: |
| 23 EnableDebuggingScreenHandler(); |
| 24 virtual ~EnableDebuggingScreenHandler(); |
| 25 |
| 26 // EnableDebuggingScreenActor implementation: |
| 27 virtual void PrepareToShow() override; |
| 28 virtual void Show() override; |
| 29 virtual void Hide() override; |
| 30 virtual void SetDelegate(Delegate* delegate) override; |
| 31 |
| 32 // BaseScreenHandler implementation: |
| 33 virtual void DeclareLocalizedValues(LocalizedValuesBuilder* builder) override; |
| 34 virtual void Initialize() override; |
| 35 |
| 36 // WebUIMessageHandler implementation: |
| 37 virtual void RegisterMessages() override; |
| 38 |
| 39 // Registers Local State preferences. |
| 40 static void RegisterPrefs(PrefRegistrySimple* registry); |
| 41 |
| 42 private: |
| 43 enum UIState { |
| 44 UI_STATE_ERROR = -1, |
| 45 UI_STATE_REMOVE_PROTECTION = 1, |
| 46 UI_STATE_SETUP = 2, |
| 47 UI_STATE_WAIT = 3, |
| 48 UI_STATE_DONE = 4, |
| 49 }; |
| 50 |
| 51 // JS messages handlers. |
| 52 void HandleOnCancel(); |
| 53 void HandleOnDone(); |
| 54 void HandleOnLearnMore(); |
| 55 void HandleOnRemoveRootFSProtection(); |
| 56 void HandleOnSetup(const std::string& password); |
| 57 |
| 58 void ShowWithParams(); |
| 59 void EnableChromeDevFeatures(const std::string& password); |
| 60 |
| 61 // Callback for DebugDaemonClient::EnableDebuggingFeatures(). |
| 62 void OnEnableDebuggingFeatures(bool success); |
| 63 |
| 64 // Callback for DebugDaemonClient::QueryDebuggingFeatures(). |
| 65 void OnQueryDebuggingFeatures(bool success, int features_flag); |
| 66 |
| 67 // Callback for DebugDaemonClient::RemoveRootfsVerification(). |
| 68 void OnRemoveRootfsVerification(bool success); |
| 69 |
| 70 // Updates UI state. |
| 71 void UpdateUIState(UIState state); |
| 72 |
| 73 Delegate* delegate_; |
| 74 |
| 75 // Help application used for help dialogs. |
| 76 scoped_refptr<HelpAppLauncher> help_app_; |
| 77 |
| 78 // Keeps whether screen should be shown right after initialization. |
| 79 bool show_on_init_; |
| 80 |
| 81 base::WeakPtrFactory<EnableDebuggingScreenHandler> weak_ptr_factory_; |
| 82 |
| 83 DISALLOW_COPY_AND_ASSIGN(EnableDebuggingScreenHandler); |
| 84 }; |
| 85 |
| 86 } // namespace chromeos |
| 87 |
| 88 #endif // CHROME_BROWSER_UI_WEBUI_CHROMEOS_LOGIN_ENABLE_DEBUGGING_SCREEN_HANDLE
R_H_ |
OLD | NEW |