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

Side by Side Diff: chrome/browser/ui/webui/chromeos/sim_unlock_ui.cc

Issue 8113025: base::Bind: More converts, mostly in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
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/logging.h" 10 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
11 #include "base/string_piece.h" 12 #include "base/string_piece.h"
12 #include "base/values.h" 13 #include "base/values.h"
13 #include "chrome/browser/chromeos/cros/cros_library.h" 14 #include "chrome/browser/chromeos/cros/cros_library.h"
14 #include "chrome/browser/chromeos/cros/network_library.h" 15 #include "chrome/browser/chromeos/cros/network_library.h"
15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" 16 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 18 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
18 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 } 468 }
468 469
469 void SimUnlockHandler::HandleCancel(const ListValue* args) { 470 void SimUnlockHandler::HandleCancel(const ListValue* args) {
470 const size_t kEnterCodeParamCount = 0; 471 const size_t kEnterCodeParamCount = 0;
471 if (args->GetSize() != kEnterCodeParamCount) { 472 if (args->GetSize() != kEnterCodeParamCount) {
472 NOTREACHED(); 473 NOTREACHED();
473 return; 474 return;
474 } 475 }
475 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); 476 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr());
476 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 477 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
477 NewRunnableMethod(task.get(), &TaskProxy::HandleCancel)); 478 base::Bind(&TaskProxy::HandleCancel, task.get()));
478 } 479 }
479 480
480 void SimUnlockHandler::HandleChangePinCode(const ListValue* args) { 481 void SimUnlockHandler::HandleChangePinCode(const ListValue* args) {
481 const size_t kChangePinParamCount = 2; 482 const size_t kChangePinParamCount = 2;
482 std::string pin; 483 std::string pin;
483 std::string new_pin; 484 std::string new_pin;
484 if (args->GetSize() != kChangePinParamCount || 485 if (args->GetSize() != kChangePinParamCount ||
485 !args->GetString(0, &pin) || 486 !args->GetString(0, &pin) ||
486 !args->GetString(1, &new_pin)) { 487 !args->GetString(1, &new_pin)) {
487 NOTREACHED(); 488 NOTREACHED();
488 return; 489 return;
489 } 490 }
490 new_pin_ = new_pin; 491 new_pin_ = new_pin;
491 HandleEnterCode(CODE_PIN, pin); 492 HandleEnterCode(CODE_PIN, pin);
492 } 493 }
493 494
494 void SimUnlockHandler::HandleEnterCode(SimUnlockCode code_type, 495 void SimUnlockHandler::HandleEnterCode(SimUnlockCode code_type,
495 const std::string& code) { 496 const std::string& code) {
496 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), code, code_type); 497 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr(), code, code_type);
497 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 498 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
498 NewRunnableMethod(task.get(), &TaskProxy::HandleEnterCode)); 499 base::Bind(&TaskProxy::HandleEnterCode, task.get()));
499 } 500 }
500 501
501 void SimUnlockHandler::HandleEnterPinCode(const ListValue* args) { 502 void SimUnlockHandler::HandleEnterPinCode(const ListValue* args) {
502 const size_t kEnterPinParamCount = 1; 503 const size_t kEnterPinParamCount = 1;
503 std::string pin; 504 std::string pin;
504 if (args->GetSize() != kEnterPinParamCount || !args->GetString(0, &pin)) { 505 if (args->GetSize() != kEnterPinParamCount || !args->GetString(0, &pin)) {
505 NOTREACHED(); 506 NOTREACHED();
506 return; 507 return;
507 } 508 }
508 HandleEnterCode(CODE_PIN, pin); 509 HandleEnterCode(CODE_PIN, pin);
(...skipping 14 matching lines...) Expand all
523 } 524 }
524 525
525 void SimUnlockHandler::HandleProceedToPukInput(const ListValue* args) { 526 void SimUnlockHandler::HandleProceedToPukInput(const ListValue* args) {
526 const size_t kProceedToPukInputParamCount = 0; 527 const size_t kProceedToPukInputParamCount = 0;
527 if (args->GetSize() != kProceedToPukInputParamCount) { 528 if (args->GetSize() != kProceedToPukInputParamCount) {
528 NOTREACHED(); 529 NOTREACHED();
529 return; 530 return;
530 } 531 }
531 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); 532 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr());
532 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 533 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
533 NewRunnableMethod(task.get(), &TaskProxy::HandleProceedToPukInput)); 534 base::Bind(&TaskProxy::HandleProceedToPukInput, task.get()));
534 } 535 }
535 536
536 void SimUnlockHandler::HandleSimStatusInitialize(const ListValue* args) { 537 void SimUnlockHandler::HandleSimStatusInitialize(const ListValue* args) {
537 const size_t kSimStatusInitializeParamCount = 1; 538 const size_t kSimStatusInitializeParamCount = 1;
538 double mode; 539 double mode;
539 if (args->GetSize() != kSimStatusInitializeParamCount || 540 if (args->GetSize() != kSimStatusInitializeParamCount ||
540 !args->GetDouble(0, &mode)) { 541 !args->GetDouble(0, &mode)) {
541 NOTREACHED(); 542 NOTREACHED();
542 return; 543 return;
543 } 544 }
544 dialog_mode_ = static_cast<SimDialogDelegate::SimDialogMode>(mode); 545 dialog_mode_ = static_cast<SimDialogDelegate::SimDialogMode>(mode);
545 VLOG(1) << "Initializing SIM dialog in mode: " << dialog_mode_; 546 VLOG(1) << "Initializing SIM dialog in mode: " << dialog_mode_;
546 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr()); 547 scoped_refptr<TaskProxy> task = new TaskProxy(AsWeakPtr());
547 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, 548 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
548 NewRunnableMethod(task.get(), &TaskProxy::HandleInitialize)); 549 base::Bind(&TaskProxy::HandleInitialize, task.get()));
549 } 550 }
550 551
551 void SimUnlockHandler::InitializeSimStatus() { 552 void SimUnlockHandler::InitializeSimStatus() {
552 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 553 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
553 ProcessSimCardState(GetCellularDevice()); 554 ProcessSimCardState(GetCellularDevice());
554 } 555 }
555 556
556 void SimUnlockHandler::ProceedToPukInput() { 557 void SimUnlockHandler::ProceedToPukInput() {
557 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 558 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
558 ProcessSimCardState(GetCellularDevice()); 559 ProcessSimCardState(GetCellularDevice());
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 AddMessageHandler((handler)->Attach(this)); 669 AddMessageHandler((handler)->Attach(this));
669 handler->Init(contents); 670 handler->Init(contents);
670 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); 671 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource();
671 672
672 // Set up the chrome://sim-unlock/ source. 673 // Set up the chrome://sim-unlock/ source.
673 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 674 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
674 profile->GetChromeURLDataManager()->AddDataSource(html_source); 675 profile->GetChromeURLDataManager()->AddDataSource(html_source);
675 } 676 }
676 677
677 } // namespace chromeos 678 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698