| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLER_H
_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLER_H
_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLER_H
_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLER_H
_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/signin/easy_unlock_service_observer.h" | 9 #include "chrome/browser/signin/easy_unlock_service_observer.h" |
| 10 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 10 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 11 #include "components/prefs/pref_change_registrar.h" |
| 11 | 12 |
| 12 namespace content { | 13 namespace content { |
| 13 class WebUIDataSource; | 14 class WebUIDataSource; |
| 14 } | 15 } |
| 15 | 16 |
| 16 class Profile; | 17 class Profile; |
| 17 | 18 |
| 18 namespace chromeos { | 19 namespace chromeos { |
| 19 namespace settings { | 20 namespace settings { |
| 20 | 21 |
| 21 class EasyUnlockSettingsHandler : public ::settings::SettingsPageUIHandler, | 22 class EasyUnlockSettingsHandler : public ::settings::SettingsPageUIHandler, |
| 22 public EasyUnlockServiceObserver { | 23 public EasyUnlockServiceObserver { |
| 23 public: | 24 public: |
| 24 // Returns nullptr if EasyUnlock is not allowed for this device. | 25 // Returns nullptr if EasyUnlock is not allowed for this device. |
| 25 static EasyUnlockSettingsHandler* Create( | 26 static EasyUnlockSettingsHandler* Create( |
| 26 content::WebUIDataSource* html_source, | 27 content::WebUIDataSource* html_source, |
| 27 Profile* profile); | 28 Profile* profile); |
| 28 | 29 |
| 29 ~EasyUnlockSettingsHandler() override; | 30 ~EasyUnlockSettingsHandler() override; |
| 30 | 31 |
| 31 // SettingsPageUIHandler: | 32 // SettingsPageUIHandler: |
| 32 void RegisterMessages() override; | 33 void RegisterMessages() override; |
| 34 void RenderViewReused() override; |
| 33 | 35 |
| 34 // EasyUnlockServiceObserver: | 36 // EasyUnlockServiceObserver: |
| 35 void OnTurnOffOperationStatusChanged() override; | 37 void OnTurnOffOperationStatusChanged() override; |
| 36 | 38 |
| 37 protected: | 39 protected: |
| 38 explicit EasyUnlockSettingsHandler(Profile* profile); | 40 explicit EasyUnlockSettingsHandler(Profile* profile); |
| 39 | 41 |
| 40 private: | 42 private: |
| 43 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, EnabledStatus); |
| 41 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffStatus); | 44 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffStatus); |
| 42 | 45 |
| 46 void SendEnabledStatus(); |
| 43 void SendTurnOffOperationStatus(); | 47 void SendTurnOffOperationStatus(); |
| 44 | 48 |
| 45 // JS callbacks. | 49 // JS callbacks. |
| 50 void HandleGetEnabledStatus(const base::ListValue* args); |
| 46 void HandleGetTurnOffFlowStatus(const base::ListValue* args); | 51 void HandleGetTurnOffFlowStatus(const base::ListValue* args); |
| 47 void HandleRequestTurnOff(const base::ListValue* args); | 52 void HandleRequestTurnOff(const base::ListValue* args); |
| 48 void HandlePageDismissed(const base::ListValue* args); | 53 void HandlePageDismissed(const base::ListValue* args); |
| 49 | 54 |
| 50 Profile* const profile_; | 55 Profile* const profile_; |
| 51 | 56 |
| 57 PrefChangeRegistrar profile_pref_registrar_; |
| 58 |
| 59 bool observers_registered_; |
| 60 |
| 52 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler); | 61 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler); |
| 53 }; | 62 }; |
| 54 | 63 |
| 55 } // namespace settings | 64 } // namespace settings |
| 56 } // namespace chromeos | 65 } // namespace chromeos |
| 57 | 66 |
| 58 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLE
R_H_ | 67 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLE
R_H_ |
| OLD | NEW |