| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 } | 475 } |
| 476 | 476 |
| 477 void SimUnlockHandler::HandleCancel(const ListValue* args) { | 477 void SimUnlockHandler::HandleCancel(const ListValue* args) { |
| 478 const size_t kEnterCodeParamCount = 0; | 478 const size_t kEnterCodeParamCount = 0; |
| 479 if (args->GetSize() != kEnterCodeParamCount) { | 479 if (args->GetSize() != kEnterCodeParamCount) { |
| 480 NOTREACHED(); | 480 NOTREACHED(); |
| 481 return; | 481 return; |
| 482 } | 482 } |
| 483 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); | 483 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); |
| 484 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 484 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 485 NewRunnableMethod(task.get(), &TaskProxy::HandleCancel)); | 485 base::Bind(&TaskProxy::HandleCancel, task.get())); |
| 486 } | 486 } |
| 487 | 487 |
| 488 void SimUnlockHandler::HandleChangePinCode(const ListValue* args) { | 488 void SimUnlockHandler::HandleChangePinCode(const ListValue* args) { |
| 489 const size_t kChangePinParamCount = 2; | 489 const size_t kChangePinParamCount = 2; |
| 490 std::string pin; | 490 std::string pin; |
| 491 std::string new_pin; | 491 std::string new_pin; |
| 492 if (args->GetSize() != kChangePinParamCount || | 492 if (args->GetSize() != kChangePinParamCount || |
| 493 !args->GetString(0, &pin) || | 493 !args->GetString(0, &pin) || |
| 494 !args->GetString(1, &new_pin)) { | 494 !args->GetString(1, &new_pin)) { |
| 495 NOTREACHED(); | 495 NOTREACHED(); |
| 496 return; | 496 return; |
| 497 } | 497 } |
| 498 new_pin_ = new_pin; | 498 new_pin_ = new_pin; |
| 499 HandleEnterCode(CODE_PIN, pin); | 499 HandleEnterCode(CODE_PIN, pin); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void SimUnlockHandler::HandleEnterCode(SimUnlockCode code_type, | 502 void SimUnlockHandler::HandleEnterCode(SimUnlockCode code_type, |
| 503 const std::string& code) { | 503 const std::string& code) { |
| 504 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), code, code_type); | 504 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), code, code_type); |
| 505 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 505 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 506 NewRunnableMethod(task.get(), &TaskProxy::HandleEnterCode)); | 506 base::Bind(&TaskProxy::HandleEnterCode, task.get())); |
| 507 } | 507 } |
| 508 | 508 |
| 509 void SimUnlockHandler::HandleEnterPinCode(const ListValue* args) { | 509 void SimUnlockHandler::HandleEnterPinCode(const ListValue* args) { |
| 510 const size_t kEnterPinParamCount = 1; | 510 const size_t kEnterPinParamCount = 1; |
| 511 std::string pin; | 511 std::string pin; |
| 512 if (args->GetSize() != kEnterPinParamCount || !args->GetString(0, &pin)) { | 512 if (args->GetSize() != kEnterPinParamCount || !args->GetString(0, &pin)) { |
| 513 NOTREACHED(); | 513 NOTREACHED(); |
| 514 return; | 514 return; |
| 515 } | 515 } |
| 516 HandleEnterCode(CODE_PIN, pin); | 516 HandleEnterCode(CODE_PIN, pin); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 531 } | 531 } |
| 532 | 532 |
| 533 void SimUnlockHandler::HandleProceedToPukInput(const ListValue* args) { | 533 void SimUnlockHandler::HandleProceedToPukInput(const ListValue* args) { |
| 534 const size_t kProceedToPukInputParamCount = 0; | 534 const size_t kProceedToPukInputParamCount = 0; |
| 535 if (args->GetSize() != kProceedToPukInputParamCount) { | 535 if (args->GetSize() != kProceedToPukInputParamCount) { |
| 536 NOTREACHED(); | 536 NOTREACHED(); |
| 537 return; | 537 return; |
| 538 } | 538 } |
| 539 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); | 539 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); |
| 540 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 540 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 541 NewRunnableMethod(task.get(), &TaskProxy::HandleProceedToPukInput)); | 541 base::Bind(&TaskProxy::HandleProceedToPukInput, task.get())); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void SimUnlockHandler::HandleSimStatusInitialize(const ListValue* args) { | 544 void SimUnlockHandler::HandleSimStatusInitialize(const ListValue* args) { |
| 545 const size_t kSimStatusInitializeParamCount = 1; | 545 const size_t kSimStatusInitializeParamCount = 1; |
| 546 double mode; | 546 double mode; |
| 547 if (args->GetSize() != kSimStatusInitializeParamCount || | 547 if (args->GetSize() != kSimStatusInitializeParamCount || |
| 548 !args->GetDouble(0, &mode)) { | 548 !args->GetDouble(0, &mode)) { |
| 549 NOTREACHED(); | 549 NOTREACHED(); |
| 550 return; | 550 return; |
| 551 } | 551 } |
| 552 dialog_mode_ = static_cast<SimDialogDelegate::SimDialogMode>(mode); | 552 dialog_mode_ = static_cast<SimDialogDelegate::SimDialogMode>(mode); |
| 553 VLOG(1) << "Initializing SIM dialog in mode: " << dialog_mode_; | 553 VLOG(1) << "Initializing SIM dialog in mode: " << dialog_mode_; |
| 554 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); | 554 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); |
| 555 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 555 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 556 NewRunnableMethod(task.get(), &TaskProxy::HandleInitialize)); | 556 base::Bind(&TaskProxy::HandleInitialize, task.get())); |
| 557 } | 557 } |
| 558 | 558 |
| 559 void SimUnlockHandler::InitializeSimStatus() { | 559 void SimUnlockHandler::InitializeSimStatus() { |
| 560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 560 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 561 ProcessSimCardState(GetCellularDevice()); | 561 ProcessSimCardState(GetCellularDevice()); |
| 562 } | 562 } |
| 563 | 563 |
| 564 void SimUnlockHandler::ProceedToPukInput() { | 564 void SimUnlockHandler::ProceedToPukInput() { |
| 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 565 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 566 ProcessSimCardState(GetCellularDevice()); | 566 ProcessSimCardState(GetCellularDevice()); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 AddMessageHandler((handler)->Attach(this)); | 676 AddMessageHandler((handler)->Attach(this)); |
| 677 handler->Init(contents); | 677 handler->Init(contents); |
| 678 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); | 678 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); |
| 679 | 679 |
| 680 // Set up the chrome://sim-unlock/ source. | 680 // Set up the chrome://sim-unlock/ source. |
| 681 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); | 681 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); |
| 682 profile->GetChromeURLDataManager()->AddDataSource(html_source); | 682 profile->GetChromeURLDataManager()->AddDataSource(html_source); |
| 683 } | 683 } |
| 684 | 684 |
| 685 } // namespace chromeos | 685 } // namespace chromeos |
| OLD | NEW |