| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 return new EasyUnlockSettingsHandler(profile); | 50 return new EasyUnlockSettingsHandler(profile); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void EasyUnlockSettingsHandler::RegisterMessages() { | 53 void EasyUnlockSettingsHandler::RegisterMessages() { |
| 54 web_ui()->RegisterMessageCallback( | 54 web_ui()->RegisterMessageCallback( |
| 55 "easyUnlockGetEnabledStatus", | 55 "easyUnlockGetEnabledStatus", |
| 56 base::Bind(&EasyUnlockSettingsHandler::HandleGetEnabledStatus, | 56 base::Bind(&EasyUnlockSettingsHandler::HandleGetEnabledStatus, |
| 57 base::Unretained(this))); | 57 base::Unretained(this))); |
| 58 web_ui()->RegisterMessageCallback( | 58 web_ui()->RegisterMessageCallback( |
| 59 "easyUnlockLaunchSetup", |
| 60 base::Bind(&EasyUnlockSettingsHandler::HandleLaunchSetup, |
| 61 base::Unretained(this))); |
| 62 web_ui()->RegisterMessageCallback( |
| 59 "easyUnlockGetTurnOffFlowStatus", | 63 "easyUnlockGetTurnOffFlowStatus", |
| 60 base::Bind(&EasyUnlockSettingsHandler::HandleGetTurnOffFlowStatus, | 64 base::Bind(&EasyUnlockSettingsHandler::HandleGetTurnOffFlowStatus, |
| 61 base::Unretained(this))); | 65 base::Unretained(this))); |
| 62 web_ui()->RegisterMessageCallback( | 66 web_ui()->RegisterMessageCallback( |
| 63 "easyUnlockRequestTurnOff", | 67 "easyUnlockRequestTurnOff", |
| 64 base::Bind(&EasyUnlockSettingsHandler::HandleRequestTurnOff, | 68 base::Bind(&EasyUnlockSettingsHandler::HandleRequestTurnOff, |
| 65 base::Unretained(this))); | 69 base::Unretained(this))); |
| 66 web_ui()->RegisterMessageCallback( | 70 web_ui()->RegisterMessageCallback( |
| 67 "easyUnlockTurnOffOverlayDismissed", | 71 "easyUnlockTurnOffOverlayDismissed", |
| 68 base::Bind(&EasyUnlockSettingsHandler::HandlePageDismissed, | 72 base::Bind(&EasyUnlockSettingsHandler::HandlePageDismissed, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 } | 141 } |
| 138 | 142 |
| 139 CHECK_EQ(1U, args->GetSize()); | 143 CHECK_EQ(1U, args->GetSize()); |
| 140 const base::Value* callback_id; | 144 const base::Value* callback_id; |
| 141 CHECK(args->Get(0, &callback_id)); | 145 CHECK(args->Get(0, &callback_id)); |
| 142 ResolveJavascriptCallback( | 146 ResolveJavascriptCallback( |
| 143 *callback_id, | 147 *callback_id, |
| 144 base::FundamentalValue(EasyUnlockService::Get(profile_)->IsEnabled())); | 148 base::FundamentalValue(EasyUnlockService::Get(profile_)->IsEnabled())); |
| 145 } | 149 } |
| 146 | 150 |
| 151 void EasyUnlockSettingsHandler::HandleLaunchSetup( |
| 152 const base::ListValue* args) { |
| 153 EasyUnlockService::Get(profile_)->LaunchSetup(); |
| 154 } |
| 155 |
| 147 void EasyUnlockSettingsHandler::HandleGetTurnOffFlowStatus( | 156 void EasyUnlockSettingsHandler::HandleGetTurnOffFlowStatus( |
| 148 const base::ListValue* args) { | 157 const base::ListValue* args) { |
| 149 SendTurnOffOperationStatus(); | 158 SendTurnOffOperationStatus(); |
| 150 } | 159 } |
| 151 | 160 |
| 152 void EasyUnlockSettingsHandler::HandleRequestTurnOff( | 161 void EasyUnlockSettingsHandler::HandleRequestTurnOff( |
| 153 const base::ListValue* args) { | 162 const base::ListValue* args) { |
| 154 EasyUnlockService::Get(profile_)->RunTurnOffFlow(); | 163 EasyUnlockService::Get(profile_)->RunTurnOffFlow(); |
| 155 } | 164 } |
| 156 | 165 |
| 157 void EasyUnlockSettingsHandler::HandlePageDismissed( | 166 void EasyUnlockSettingsHandler::HandlePageDismissed( |
| 158 const base::ListValue* args) { | 167 const base::ListValue* args) { |
| 159 EasyUnlockService::Get(profile_)->ResetTurnOffFlow(); | 168 EasyUnlockService::Get(profile_)->ResetTurnOffFlow(); |
| 160 } | 169 } |
| 161 | 170 |
| 162 } // namespace settings | 171 } // namespace settings |
| 163 } // namespace chromeos | 172 } // namespace chromeos |
| OLD | NEW |