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

Side by Side Diff: chrome/browser/chromeos/net/network_change_notifier_chromeos.cc

Issue 11367048: This is the first pass at making GetIPConfigs asynchronous. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
OLDNEW
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/chromeos/net/network_change_notifier_chromeos.h" 5 #include "chrome/browser/chromeos/net/network_change_notifier_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "chrome/browser/chromeos/cros/cros_library.h" 8 #include "chrome/browser/chromeos/cros/cros_library.h"
9 #include "chromeos/dbus/dbus_thread_manager.h" 9 #include "chromeos/dbus/dbus_thread_manager.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Active network changed? 124 // Active network changed?
125 if (network->service_path() != service_path_) 125 if (network->service_path() != service_path_)
126 UpdateNetworkState(cros); 126 UpdateNetworkState(cros);
127 else 127 else
128 UpdateConnectivityState(network); 128 UpdateConnectivityState(network);
129 } 129 }
130 130
131 void NetworkChangeNotifierChromeos::UpdateNetworkState( 131 void NetworkChangeNotifierChromeos::UpdateNetworkState(
132 chromeos::NetworkLibrary* lib) { 132 chromeos::NetworkLibrary* lib) {
133 const chromeos::Network* network = lib->active_network(); 133 const chromeos::Network* network = lib->active_network();
134 if (network) {
135 lib->GetIPConfigs(
136 network->device_path(),
137 chromeos::NetworkLibrary::FORMAT_COLON_SEPARATED_HEX,
138 base::Bind(&NetworkChangeNotifierChromeos::UpdateNetworkStateCallback,
139 weak_factory_.GetWeakPtr(),
140 lib));
141 }
142 }
143
144 void NetworkChangeNotifierChromeos::UpdateNetworkStateCallback(
145 chromeos::NetworkLibrary* lib,
146 const NetworkIPConfigVector& ipconfigs,
147 const std::string& hardware_address) {
148 const chromeos::Network* network = lib->active_network();
134 149
135 if (network) { 150 if (network) {
136 VLOG(1) << "UpdateNetworkState: " << network->name() 151 VLOG(1) << "UpdateNetworkStateCallback: " << network->name()
137 << ", type= " << network->type() 152 << ", type= " << network->type()
138 << ", device= " << network->device_path() 153 << ", device= " << network->device_path()
139 << ", state= " << network->state(); 154 << ", state= " << network->state();
140 } 155 }
141 156
142 // Check if active network was added, removed or changed. 157 // Check if active network was added, removed or changed.
143 if ((!network && has_active_network_) || 158 if ((!network && has_active_network_) ||
144 (network && (!has_active_network_ || 159 (network && (!has_active_network_ ||
145 network->service_path() != service_path_ || 160 network->service_path() != service_path_ ||
146 network->ip_address() != ip_address_))) { 161 network->ip_address() != ip_address_))) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 } 298 }
284 case chromeos::TYPE_BLUETOOTH: 299 case chromeos::TYPE_BLUETOOTH:
285 case chromeos::TYPE_VPN: 300 case chromeos::TYPE_VPN:
286 case chromeos::TYPE_UNKNOWN: 301 case chromeos::TYPE_UNKNOWN:
287 break; 302 break;
288 } 303 }
289 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN; 304 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN;
290 } 305 }
291 306
292 } // namespace chromeos 307 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/net/network_change_notifier_chromeos.h ('k') | chrome/browser/chromeos/status/network_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698