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

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

Issue 8113018: [web-ui] Migrate RegisterMessageCallback usage to base::bind(). (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"
10 #include "base/bind_helpers.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
11 #include "base/string_piece.h" 13 #include "base/string_piece.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "chrome/browser/chromeos/cros/cros_library.h" 15 #include "chrome/browser/chromeos/cros/cros_library.h"
14 #include "chrome/browser/chromeos/cros/network_library.h" 16 #include "chrome/browser/chromeos/cros/network_library.h"
15 #include "chrome/browser/chromeos/sim_dialog_delegate.h" 17 #include "chrome/browser/chromeos/sim_dialog_delegate.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
18 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 WebUIMessageHandler* SimUnlockHandler::Attach(WebUI* web_ui) { 339 WebUIMessageHandler* SimUnlockHandler::Attach(WebUI* web_ui) {
338 return WebUIMessageHandler::Attach(web_ui); 340 return WebUIMessageHandler::Attach(web_ui);
339 } 341 }
340 342
341 void SimUnlockHandler::Init(TabContents* contents) { 343 void SimUnlockHandler::Init(TabContents* contents) {
342 tab_contents_ = contents; 344 tab_contents_ = contents;
343 } 345 }
344 346
345 void SimUnlockHandler::RegisterMessages() { 347 void SimUnlockHandler::RegisterMessages() {
346 web_ui_->RegisterMessageCallback(kJsApiCancel, 348 web_ui_->RegisterMessageCallback(kJsApiCancel,
347 NewCallback(this, &SimUnlockHandler::HandleCancel)); 349 base::Bind(&SimUnlockHandler::HandleCancel,
350 base::Unretained(this)));
348 web_ui_->RegisterMessageCallback(kJsApiChangePinCode, 351 web_ui_->RegisterMessageCallback(kJsApiChangePinCode,
349 NewCallback(this, &SimUnlockHandler::HandleChangePinCode)); 352 base::Bind(&SimUnlockHandler::HandleChangePinCode,
353 base::Unretained(this)));
350 web_ui_->RegisterMessageCallback(kJsApiEnterPinCode, 354 web_ui_->RegisterMessageCallback(kJsApiEnterPinCode,
351 NewCallback(this, &SimUnlockHandler::HandleEnterPinCode)); 355 base::Bind(&SimUnlockHandler::HandleEnterPinCode,
356 base::Unretained(this)));
352 web_ui_->RegisterMessageCallback(kJsApiEnterPukCode, 357 web_ui_->RegisterMessageCallback(kJsApiEnterPukCode,
353 NewCallback(this, &SimUnlockHandler::HandleEnterPukCode)); 358 base::Bind(&SimUnlockHandler::HandleEnterPukCode,
359 base::Unretained(this)));
354 web_ui_->RegisterMessageCallback(kJsApiProceedToPukInput, 360 web_ui_->RegisterMessageCallback(kJsApiProceedToPukInput,
355 NewCallback(this, &SimUnlockHandler::HandleProceedToPukInput)); 361 base::Bind(&SimUnlockHandler::HandleProceedToPukInput,
362 base::Unretained(this)));
356 web_ui_->RegisterMessageCallback(kJsApiSimStatusInitialize, 363 web_ui_->RegisterMessageCallback(kJsApiSimStatusInitialize,
357 NewCallback(this, &SimUnlockHandler::HandleSimStatusInitialize)); 364 base::Bind(&SimUnlockHandler::HandleSimStatusInitialize,
365 base::Unretained(this)));
358 } 366 }
359 367
360 void SimUnlockHandler::OnNetworkDeviceSimLockChanged( 368 void SimUnlockHandler::OnNetworkDeviceSimLockChanged(
361 NetworkLibrary* cros, const NetworkDevice* device) { 369 NetworkLibrary* cros, const NetworkDevice* device) {
362 chromeos::SimLockState lock_state = device->sim_lock_state(); 370 chromeos::SimLockState lock_state = device->sim_lock_state();
363 int retries_left = device->sim_retries_left(); 371 int retries_left = device->sim_retries_left();
364 VLOG(1) << "OnNetworkDeviceSimLockChanged, lock: " << lock_state 372 VLOG(1) << "OnNetworkDeviceSimLockChanged, lock: " << lock_state
365 << ", retries: " << retries_left; 373 << ", retries: " << retries_left;
366 // There's a pending PIN operation. 374 // There's a pending PIN operation.
367 // Wait for it to finish and refresh state then. 375 // Wait for it to finish and refresh state then.
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 AddMessageHandler((handler)->Attach(this)); 676 AddMessageHandler((handler)->Attach(this));
669 handler->Init(contents); 677 handler->Init(contents);
670 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource(); 678 SimUnlockUIHTMLSource* html_source = new SimUnlockUIHTMLSource();
671 679
672 // Set up the chrome://sim-unlock/ source. 680 // Set up the chrome://sim-unlock/ source.
673 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 681 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
674 profile->GetChromeURLDataManager()->AddDataSource(html_source); 682 profile->GetChromeURLDataManager()->AddDataSource(html_source);
675 } 683 }
676 684
677 } // namespace chromeos 685 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/register_page_ui.cc ('k') | chrome/browser/ui/webui/collected_cookies_ui_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698