Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/shill_property_handler.h" | 5 #include "chromeos/network/shill_property_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/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 if (path.empty()) | 392 if (path.empty()) |
| 393 continue; | 393 continue; |
| 394 ShillPropertyObserverMap::iterator iter2 = observer_map.find(path); | 394 ShillPropertyObserverMap::iterator iter2 = observer_map.find(path); |
| 395 if (iter2 != observer_map.end()) { | 395 if (iter2 != observer_map.end()) { |
| 396 new_observed[path] = iter2->second; | 396 new_observed[path] = iter2->second; |
| 397 } else { | 397 } else { |
| 398 // Create an observer for future updates. | 398 // Create an observer for future updates. |
| 399 new_observed[path] = new ShillPropertyObserver( | 399 new_observed[path] = new ShillPropertyObserver( |
| 400 type, path, base::Bind( | 400 type, path, base::Bind( |
| 401 &ShillPropertyHandler::PropertyChangedCallback, AsWeakPtr())); | 401 &ShillPropertyHandler::PropertyChangedCallback, AsWeakPtr())); |
| 402 NET_LOG_DEBUG("StartObserving", path); | |
|
stevenjb
2013/08/12 21:33:10
Note: These were helpful initially but are now jus
| |
| 403 } | 402 } |
| 404 observer_map.erase(path); | 403 observer_map.erase(path); |
| 405 // Limit the number of observed services. | 404 // Limit the number of observed services. |
| 406 if (new_observed.size() >= kMaxObserved) | 405 if (new_observed.size() >= kMaxObserved) |
| 407 break; | 406 break; |
| 408 } | 407 } |
| 409 // Delete network service observers still in observer_map. | 408 // Delete network service observers still in observer_map. |
| 410 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); | 409 for (ShillPropertyObserverMap::iterator iter = observer_map.begin(); |
| 411 iter != observer_map.end(); ++iter) { | 410 iter != observer_map.end(); ++iter) { |
| 412 NET_LOG_DEBUG("StopObserving", iter->first); | |
| 413 delete iter->second; | 411 delete iter->second; |
| 414 } | 412 } |
| 415 observer_map.swap(new_observed); | 413 observer_map.swap(new_observed); |
| 416 } | 414 } |
| 417 | 415 |
| 418 void ShillPropertyHandler::UpdateAvailableTechnologies( | 416 void ShillPropertyHandler::UpdateAvailableTechnologies( |
| 419 const base::ListValue& technologies) { | 417 const base::ListValue& technologies) { |
| 420 available_technologies_.clear(); | 418 available_technologies_.clear(); |
| 421 NET_LOG_EVENT("AvailableTechnologiesChanged", | 419 NET_LOG_EVENT("AvailableTechnologiesChanged", |
| 422 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); | 420 base::StringPrintf("Size: %" PRIuS, technologies.GetSize())); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 | 584 |
| 587 void ShillPropertyHandler::NetworkDevicePropertyChangedCallback( | 585 void ShillPropertyHandler::NetworkDevicePropertyChangedCallback( |
| 588 const std::string& path, | 586 const std::string& path, |
| 589 const std::string& key, | 587 const std::string& key, |
| 590 const base::Value& value) { | 588 const base::Value& value) { |
| 591 listener_->UpdateDeviceProperty(path, key, value); | 589 listener_->UpdateDeviceProperty(path, key, value); |
| 592 } | 590 } |
| 593 | 591 |
| 594 } // namespace internal | 592 } // namespace internal |
| 595 } // namespace chromeos | 593 } // namespace chromeos |
| OLD | NEW |