| 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 "content/public/browser/web_ui_message_handler.h" | 10 #include "chrome/browser/ui/webui/settings/md_settings_ui.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 class WebUIDataSource; | 13 class WebUIDataSource; |
| 14 } | 14 } |
| 15 | 15 |
| 16 class Profile; | 16 class Profile; |
| 17 | 17 |
| 18 namespace chromeos { | 18 namespace chromeos { |
| 19 namespace settings { | 19 namespace settings { |
| 20 | 20 |
| 21 class EasyUnlockSettingsHandler : public content::WebUIMessageHandler, | 21 class EasyUnlockSettingsHandler : public ::settings::SettingsPageUIHandler, |
| 22 public EasyUnlockServiceObserver { | 22 public EasyUnlockServiceObserver { |
| 23 public: | 23 public: |
| 24 // Returns nullptr if EasyUnlock is not allowed for this device. | 24 // Returns nullptr if EasyUnlock is not allowed for this device. |
| 25 static EasyUnlockSettingsHandler* Create( | 25 static EasyUnlockSettingsHandler* Create( |
| 26 content::WebUIDataSource* html_source, | 26 content::WebUIDataSource* html_source, |
| 27 Profile* profile); | 27 Profile* profile); |
| 28 | 28 |
| 29 ~EasyUnlockSettingsHandler() override; | 29 ~EasyUnlockSettingsHandler() override; |
| 30 | 30 |
| 31 // WebUIMessageHandler | 31 // SettingsPageUIHandler: |
| 32 void RegisterMessages() override; | 32 void RegisterMessages() override; |
| 33 | 33 |
| 34 // EasyUnlockServiceObserver | 34 // EasyUnlockServiceObserver: |
| 35 void OnTurnOffOperationStatusChanged() override; | 35 void OnTurnOffOperationStatusChanged() override; |
| 36 | 36 |
| 37 protected: | 37 protected: |
| 38 explicit EasyUnlockSettingsHandler(Profile* profile); | 38 explicit EasyUnlockSettingsHandler(Profile* profile); |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffStatus); | 41 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffStatus); |
| 42 | 42 |
| 43 void SendTurnOffOperationStatus(); | 43 void SendTurnOffOperationStatus(); |
| 44 | 44 |
| 45 // JS callbacks. | 45 // JS callbacks. |
| 46 void HandleGetTurnOffFlowStatus(const base::ListValue* args); | 46 void HandleGetTurnOffFlowStatus(const base::ListValue* args); |
| 47 void HandleRequestTurnOff(const base::ListValue* args); | 47 void HandleRequestTurnOff(const base::ListValue* args); |
| 48 void HandlePageDismissed(const base::ListValue* args); | 48 void HandlePageDismissed(const base::ListValue* args); |
| 49 | 49 |
| 50 Profile* const profile_; | 50 Profile* const profile_; |
| 51 | 51 |
| 52 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler); | 52 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace settings | 55 } // namespace settings |
| 56 } // namespace chromeos | 56 } // namespace chromeos |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLE
R_H_ | 58 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_CHROMEOS_EASY_UNLOCK_SETTINGS_HANDLE
R_H_ |
| OLD | NEW |