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

Side by Side Diff: chromeos/network/network_state_handler.cc

Issue 12634019: NetworkChangeNotifierChromeos: Handle IPConfig property changes on the default network (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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) 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 "chromeos/network/network_state_handler.h" 5 #include "chromeos/network/network_state_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/format_macros.h" 8 #include "base/format_macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 std::string prev_connection_state = network->connection_state(); 426 std::string prev_connection_state = network->connection_state();
427 if (!network->PropertyChanged(key, value)) 427 if (!network->PropertyChanged(key, value))
428 return; 428 return;
429 429
430 std::string detail = network->name() + "." + key; 430 std::string detail = network->name() + "." + key;
431 std::string vstr = ValueAsString(value); 431 std::string vstr = ValueAsString(value);
432 if (!vstr.empty()) 432 if (!vstr.empty())
433 detail += " = " + vstr; 433 detail += " = " + vstr;
434 network_event_log::AddEntry(kLogModule, "NetworkPropertyUpdated", detail); 434 network_event_log::AddEntry(kLogModule, "NetworkPropertyUpdated", detail);
435 435
436 if (network->connection_state() != prev_connection_state) 436 if (network->connection_state() != prev_connection_state) {
437 OnNetworkConnectionStateChanged(network); 437 OnNetworkConnectionStateChanged(network);
438 }
439 else if (network->path() == default_network_path_ &&
440 key != flimflam::kSignalStrengthProperty) {
441 // WiFi signal strength updates are too noisy, so don't
442 // trigger default network updates for those changes.
443 OnDefaultNetworkChanged();
444 }
445
438 NetworkPropertiesUpdated(network); 446 NetworkPropertiesUpdated(network);
439 } 447 }
440 448
441 void NetworkStateHandler::UpdateNetworkServiceIPAddress(
442 const std::string& service_path,
443 const std::string& ip_address) {
444 NetworkState* network = GetModifiableNetworkState(service_path);
445 if (!network)
446 return;
447 std::string detail = network->name() + ".IPAddress = " + ip_address;
448 network_event_log::AddEntry(kLogModule, "NetworkIPChanged", detail);
449 network->set_ip_address(ip_address);
450 NetworkPropertiesUpdated(network);
451 }
452
453 void NetworkStateHandler::UpdateDeviceProperty(const std::string& device_path, 449 void NetworkStateHandler::UpdateDeviceProperty(const std::string& device_path,
454 const std::string& key, 450 const std::string& key,
455 const base::Value& value) { 451 const base::Value& value) {
456 DeviceState* device = GetModifiableDeviceState(device_path); 452 DeviceState* device = GetModifiableDeviceState(device_path);
457 if (!device) 453 if (!device)
458 return; 454 return;
459 if (!device->PropertyChanged(key, value)) 455 if (!device->PropertyChanged(key, value))
460 return; 456 return;
461 457
462 std::string detail = device->name() + "." + key; 458 std::string detail = device->name() + "." + key;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 return; 599 return;
604 ScanCallbackList& callback_list = scan_complete_callbacks_[type]; 600 ScanCallbackList& callback_list = scan_complete_callbacks_[type];
605 for (ScanCallbackList::iterator iter = callback_list.begin(); 601 for (ScanCallbackList::iterator iter = callback_list.begin();
606 iter != callback_list.end(); ++iter) { 602 iter != callback_list.end(); ++iter) {
607 (*iter).Run(); 603 (*iter).Run();
608 } 604 }
609 scan_complete_callbacks_.erase(type); 605 scan_complete_callbacks_.erase(type);
610 } 606 }
611 607
612 } // namespace chromeos 608 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/network_state_handler.h ('k') | chromeos/network/network_state_handler_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698