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

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

Issue 8113025: base::Bind: More converts, mostly in WebUI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. 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/choose_mobile_network_ui.h" 5 #include "chrome/browser/ui/webui/chromeos/choose_mobile_network_ui.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h"
11 #include "base/bind_helpers.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/string_number_conversions.h" 13 #include "base/string_number_conversions.h"
12 #include "base/string_piece.h" 14 #include "base/string_piece.h"
13 #include "base/values.h" 15 #include "base/values.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 16 #include "chrome/browser/chromeos/cros/cros_library.h"
15 #include "chrome/browser/chromeos/cros/network_library.h" 17 #include "chrome/browser/chromeos/cros/network_library.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/jstemplate_builder.h" 20 #include "chrome/common/jstemplate_builder.h"
19 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 ChooseMobileNetworkHandler::~ChooseMobileNetworkHandler() { 148 ChooseMobileNetworkHandler::~ChooseMobileNetworkHandler() {
147 if (!device_path_.empty()) { 149 if (!device_path_.empty()) {
148 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary(); 150 NetworkLibrary* cros = CrosLibrary::Get()->GetNetworkLibrary();
149 cros->RemoveNetworkDeviceObserver(device_path_, this); 151 cros->RemoveNetworkDeviceObserver(device_path_, this);
150 } 152 }
151 } 153 }
152 154
153 void ChooseMobileNetworkHandler::RegisterMessages() { 155 void ChooseMobileNetworkHandler::RegisterMessages() {
154 web_ui_->RegisterMessageCallback( 156 web_ui_->RegisterMessageCallback(
155 kJsApiCancel, 157 kJsApiCancel,
156 NewCallback(this, &ChooseMobileNetworkHandler::HandleCancel)); 158 base::Bind(&ChooseMobileNetworkHandler::HandleCancel,
159 base::Unretained(this)));
157 web_ui_->RegisterMessageCallback( 160 web_ui_->RegisterMessageCallback(
158 kJsApiConnect, 161 kJsApiConnect,
159 NewCallback(this, &ChooseMobileNetworkHandler::HandleConnect)); 162 base::Bind(&ChooseMobileNetworkHandler::HandleConnect,
163 base::Unretained(this)));
160 web_ui_->RegisterMessageCallback( 164 web_ui_->RegisterMessageCallback(
161 kJsApiPageReady, 165 kJsApiPageReady,
162 NewCallback(this, &ChooseMobileNetworkHandler::HandlePageReady)); 166 base::Bind(&ChooseMobileNetworkHandler::HandlePageReady,
167 base::Unretained(this)));
163 } 168 }
164 169
165 void ChooseMobileNetworkHandler::OnNetworkDeviceFoundNetworks( 170 void ChooseMobileNetworkHandler::OnNetworkDeviceFoundNetworks(
166 NetworkLibrary* cros, 171 NetworkLibrary* cros,
167 const NetworkDevice* device) { 172 const NetworkDevice* device) {
168 networks_list_.Clear(); 173 networks_list_.Clear();
169 std::set<std::string> network_ids; 174 std::set<std::string> network_ids;
170 const CellularNetworkList& found_networks = device->found_cellular_networks(); 175 const CellularNetworkList& found_networks = device->found_cellular_networks();
171 for (CellularNetworkList::const_iterator it = found_networks.begin(); 176 for (CellularNetworkList::const_iterator it = found_networks.begin();
172 it != found_networks.end(); ++it) { 177 it != found_networks.end(); ++it) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler(); 255 ChooseMobileNetworkHandler* handler = new ChooseMobileNetworkHandler();
251 AddMessageHandler((handler)->Attach(this)); 256 AddMessageHandler((handler)->Attach(this));
252 ChooseMobileNetworkHTMLSource* html_source = 257 ChooseMobileNetworkHTMLSource* html_source =
253 new ChooseMobileNetworkHTMLSource(); 258 new ChooseMobileNetworkHTMLSource();
254 // Set up the "chrome://choose-mobile-network" source. 259 // Set up the "chrome://choose-mobile-network" source.
255 Profile* profile = Profile::FromBrowserContext(contents->browser_context()); 260 Profile* profile = Profile::FromBrowserContext(contents->browser_context());
256 profile->GetChromeURLDataManager()->AddDataSource(html_source); 261 profile->GetChromeURLDataManager()->AddDataSource(html_source);
257 } 262 }
258 263
259 } // namespace chromeos 264 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698