OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/sim_unlock_ui.h" | 5 #include "chrome/browser/ui/webui/chromeos/sim_unlock_ui.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 // Pass PIN/PUK code to shill and check status. | 199 // Pass PIN/PUK code to shill and check status. |
200 void EnterCode(const std::string& code, SimUnlockCode code_type); | 200 void EnterCode(const std::string& code, SimUnlockCode code_type); |
201 | 201 |
202 // Methods to invoke shill PIN/PUK D-Bus operations. | 202 // Methods to invoke shill PIN/PUK D-Bus operations. |
203 void ChangeRequirePin(bool require_pin, const std::string& pin); | 203 void ChangeRequirePin(bool require_pin, const std::string& pin); |
204 void EnterPin(const std::string& pin); | 204 void EnterPin(const std::string& pin); |
205 void ChangePin(const std::string& old_pin, const std::string& new_pin); | 205 void ChangePin(const std::string& old_pin, const std::string& new_pin); |
206 void UnblockPin(const std::string& puk, const std::string& new_pin); | 206 void UnblockPin(const std::string& puk, const std::string& new_pin); |
207 void PinOperationSuccessCallback(const std::string& operation_name); | 207 void PinOperationSuccessCallback(const std::string& operation_name); |
208 void PinOperationErrorCallback(const std::string& operation_name, | 208 void PinOperationErrorCallback( |
209 const std::string& error_name, | 209 const std::string& operation_name, |
210 scoped_ptr<base::DictionaryValue> error_data); | 210 const std::string& error_name, |
| 211 std::unique_ptr<base::DictionaryValue> error_data); |
211 | 212 |
212 // Called when an asynchronous PIN operation has completed. | 213 // Called when an asynchronous PIN operation has completed. |
213 void OnPinOperationCompleted(PinOperationError error); | 214 void OnPinOperationCompleted(PinOperationError error); |
214 | 215 |
215 // Single handler for PIN/PUK code operations. | 216 // Single handler for PIN/PUK code operations. |
216 void HandleEnterCode(SimUnlockCode code_type, const std::string& code); | 217 void HandleEnterCode(SimUnlockCode code_type, const std::string& code); |
217 | 218 |
218 // Handlers for JS WebUI messages. | 219 // Handlers for JS WebUI messages. |
219 void HandleChangePinCode(const base::ListValue* args); | 220 void HandleChangePinCode(const base::ListValue* args); |
220 void HandleEnterPinCode(const base::ListValue* args); | 221 void HandleEnterPinCode(const base::ListValue* args); |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 | 546 |
546 void SimUnlockHandler::PinOperationSuccessCallback( | 547 void SimUnlockHandler::PinOperationSuccessCallback( |
547 const std::string& operation_name) { | 548 const std::string& operation_name) { |
548 NET_LOG_DEBUG("Pin operation successful.", operation_name); | 549 NET_LOG_DEBUG("Pin operation successful.", operation_name); |
549 OnPinOperationCompleted(PIN_ERROR_NONE); | 550 OnPinOperationCompleted(PIN_ERROR_NONE); |
550 } | 551 } |
551 | 552 |
552 void SimUnlockHandler::PinOperationErrorCallback( | 553 void SimUnlockHandler::PinOperationErrorCallback( |
553 const std::string& operation_name, | 554 const std::string& operation_name, |
554 const std::string& error_name, | 555 const std::string& error_name, |
555 scoped_ptr<base::DictionaryValue> error_data) { | 556 std::unique_ptr<base::DictionaryValue> error_data) { |
556 NET_LOG_ERROR("Pin operation failed: " + error_name, operation_name); | 557 NET_LOG_ERROR("Pin operation failed: " + error_name, operation_name); |
557 PinOperationError pin_error; | 558 PinOperationError pin_error; |
558 if (error_name == NetworkDeviceHandler::kErrorIncorrectPin || | 559 if (error_name == NetworkDeviceHandler::kErrorIncorrectPin || |
559 error_name == NetworkDeviceHandler::kErrorPinRequired) | 560 error_name == NetworkDeviceHandler::kErrorPinRequired) |
560 pin_error = PIN_ERROR_INCORRECT_CODE; | 561 pin_error = PIN_ERROR_INCORRECT_CODE; |
561 else if (error_name == NetworkDeviceHandler::kErrorPinBlocked) | 562 else if (error_name == NetworkDeviceHandler::kErrorPinBlocked) |
562 pin_error = PIN_ERROR_BLOCKED; | 563 pin_error = PIN_ERROR_BLOCKED; |
563 else | 564 else |
564 pin_error = PIN_ERROR_UNKNOWN; | 565 pin_error = PIN_ERROR_UNKNOWN; |
565 OnPinOperationCompleted(pin_error); | 566 OnPinOperationCompleted(pin_error); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
763 SimUnlockHandler* handler = new SimUnlockHandler(); | 764 SimUnlockHandler* handler = new SimUnlockHandler(); |
764 web_ui->AddMessageHandler(handler); | 765 web_ui->AddMessageHandler(handler); |
765 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 766 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
766 | 767 |
767 // Set up the chrome://sim-unlock/ source. | 768 // Set up the chrome://sim-unlock/ source. |
768 Profile* profile = Profile::FromWebUI(web_ui); | 769 Profile* profile = Profile::FromWebUI(web_ui); |
769 content::URLDataSource::Add(profile, html_source); | 770 content::URLDataSource::Add(profile, html_source); |
770 } | 771 } |
771 | 772 |
772 } // namespace chromeos | 773 } // namespace chromeos |
OLD | NEW |