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 #include "chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler
.h" | 5 #include "chrome/browser/ui/webui/settings/chromeos/easy_unlock_settings_handler
.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 base::Bind(&EasyUnlockSettingsHandler::SendEnabledStatus, | 79 base::Bind(&EasyUnlockSettingsHandler::SendEnabledStatus, |
80 base::Unretained(this))); | 80 base::Unretained(this))); |
81 } | 81 } |
82 | 82 |
83 void EasyUnlockSettingsHandler::OnJavascriptDisallowed() { | 83 void EasyUnlockSettingsHandler::OnJavascriptDisallowed() { |
84 EasyUnlockService::Get(profile_)->RemoveObserver(this); | 84 EasyUnlockService::Get(profile_)->RemoveObserver(this); |
85 profile_pref_registrar_.RemoveAll(); | 85 profile_pref_registrar_.RemoveAll(); |
86 } | 86 } |
87 | 87 |
88 void EasyUnlockSettingsHandler::OnTurnOffOperationStatusChanged() { | 88 void EasyUnlockSettingsHandler::OnTurnOffOperationStatusChanged() { |
89 CallJavascriptFunction("cr.webUIListenerCallback", | 89 FireWebUIListener("easy-unlock-turn-off-flow-status", |
90 base::Value("easy-unlock-turn-off-flow-status"), | 90 base::Value(GetTurnOffFlowStatus())); |
91 base::Value(GetTurnOffFlowStatus())); | |
92 } | 91 } |
93 | 92 |
94 void EasyUnlockSettingsHandler::SendEnabledStatus() { | 93 void EasyUnlockSettingsHandler::SendEnabledStatus() { |
95 CallJavascriptFunction( | 94 CallJavascriptFunction( |
96 "cr.webUIListenerCallback", base::Value("easy-unlock-enabled-status"), | 95 "cr.webUIListenerCallback", base::Value("easy-unlock-enabled-status"), |
97 base::Value(EasyUnlockService::Get(profile_)->IsEnabled())); | 96 base::Value(EasyUnlockService::Get(profile_)->IsEnabled())); |
98 } | 97 } |
99 | 98 |
100 std::string EasyUnlockSettingsHandler::GetTurnOffFlowStatus() { | 99 std::string EasyUnlockSettingsHandler::GetTurnOffFlowStatus() { |
101 EasyUnlockService::TurnOffFlowStatus status = | 100 EasyUnlockService::TurnOffFlowStatus status = |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 EasyUnlockService::Get(profile_)->RunTurnOffFlow(); | 151 EasyUnlockService::Get(profile_)->RunTurnOffFlow(); |
153 } | 152 } |
154 | 153 |
155 void EasyUnlockSettingsHandler::HandleCancelTurnOffFlow( | 154 void EasyUnlockSettingsHandler::HandleCancelTurnOffFlow( |
156 const base::ListValue* args) { | 155 const base::ListValue* args) { |
157 EasyUnlockService::Get(profile_)->ResetTurnOffFlow(); | 156 EasyUnlockService::Get(profile_)->ResetTurnOffFlow(); |
158 } | 157 } |
159 | 158 |
160 } // namespace settings | 159 } // namespace settings |
161 } // namespace chromeos | 160 } // namespace chromeos |
OLD | NEW |