Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler.h

Issue 1896463003: WebUI: Add JavaScript lifecycle-control to WebUIMessageHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 // Returns nullptr if EasyUnlock is not allowed for this device. 25 // Returns nullptr if EasyUnlock is not allowed for this device.
26 static EasyUnlockSettingsHandler* Create( 26 static EasyUnlockSettingsHandler* Create(
27 content::WebUIDataSource* html_source, 27 content::WebUIDataSource* html_source,
28 Profile* profile); 28 Profile* profile);
29 29
30 ~EasyUnlockSettingsHandler() override; 30 ~EasyUnlockSettingsHandler() override;
31 31
32 // SettingsPageUIHandler: 32 // SettingsPageUIHandler:
33 void RegisterMessages() override; 33 void RegisterMessages() override;
34 void RenderViewReused() override; 34 void OnJavascriptAllowed() override;
35 void OnJavascriptDisallowed() override;
35 36
36 // EasyUnlockServiceObserver: 37 // EasyUnlockServiceObserver:
37 void OnTurnOffOperationStatusChanged() override; 38 void OnTurnOffOperationStatusChanged() override;
38 39
39 protected: 40 protected:
40 explicit EasyUnlockSettingsHandler(Profile* profile); 41 explicit EasyUnlockSettingsHandler(Profile* profile);
41 42
42 private: 43 private:
43 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, EnabledStatus); 44 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, EnabledStatus);
44 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffFlowStatus); 45 FRIEND_TEST_ALL_PREFIXES(EasyUnlockSettingsHandlerTest, TurnOffFlowStatus);
45 46
46 void SendEnabledStatus(); 47 void SendEnabledStatus();
47 std::string GetTurnOffFlowStatus(); 48 std::string GetTurnOffFlowStatus();
48 49
49 // JS callbacks. 50 // JS callbacks.
50 void HandleGetEnabledStatus(const base::ListValue* args); 51 void HandleGetEnabledStatus(const base::ListValue* args);
51 void HandleStartTurnOnFlow(const base::ListValue* args); 52 void HandleStartTurnOnFlow(const base::ListValue* args);
52 void HandleGetTurnOffFlowStatus(const base::ListValue* args); 53 void HandleGetTurnOffFlowStatus(const base::ListValue* args);
53 void HandleStartTurnOffFlow(const base::ListValue* args); 54 void HandleStartTurnOffFlow(const base::ListValue* args);
54 void HandleCancelTurnOffFlow(const base::ListValue* args); 55 void HandleCancelTurnOffFlow(const base::ListValue* args);
55 56
56 Profile* const profile_; 57 Profile* const profile_;
57 58
58 PrefChangeRegistrar profile_pref_registrar_; 59 PrefChangeRegistrar profile_pref_registrar_;
59 60
60 bool observers_registered_;
61
62 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler); 61 DISALLOW_COPY_AND_ASSIGN(EasyUnlockSettingsHandler);
63 }; 62 };
64 63
65 } // namespace settings 64 } // namespace settings
66 } // namespace chromeos 65 } // namespace chromeos
67 66
68 #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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698