| 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/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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 namespace chromeos { | 67 namespace chromeos { |
| 68 | 68 |
| 69 const char NetworkStateHandler::kMatchTypeDefault[] = "default"; | 69 const char NetworkStateHandler::kMatchTypeDefault[] = "default"; |
| 70 const char NetworkStateHandler::kMatchTypeWireless[] = "wireless"; | 70 const char NetworkStateHandler::kMatchTypeWireless[] = "wireless"; |
| 71 const char NetworkStateHandler::kMatchTypeMobile[] = "mobile"; | 71 const char NetworkStateHandler::kMatchTypeMobile[] = "mobile"; |
| 72 const char NetworkStateHandler::kMatchTypeNonVirtual[] = "non-virtual"; | 72 const char NetworkStateHandler::kMatchTypeNonVirtual[] = "non-virtual"; |
| 73 const char NetworkStateHandler::kDefaultCheckPortalList[] = |
| 74 "ethernet,wifi,cellular"; |
| 73 | 75 |
| 74 NetworkStateHandler::NetworkStateHandler() { | 76 NetworkStateHandler::NetworkStateHandler() { |
| 75 } | 77 } |
| 76 | 78 |
| 77 NetworkStateHandler::~NetworkStateHandler() { | 79 NetworkStateHandler::~NetworkStateHandler() { |
| 78 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); | 80 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); |
| 79 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); | 81 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); |
| 80 } | 82 } |
| 81 | 83 |
| 82 void NetworkStateHandler::InitShillPropertyHandler() { | 84 void NetworkStateHandler::InitShillPropertyHandler() { |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void NetworkStateHandler::SetConnectingNetwork( | 301 void NetworkStateHandler::SetConnectingNetwork( |
| 300 const std::string& service_path) { | 302 const std::string& service_path) { |
| 301 connecting_network_ = service_path; | 303 connecting_network_ = service_path; |
| 302 const NetworkState* network = GetNetworkState(service_path); | 304 const NetworkState* network = GetNetworkState(service_path); |
| 303 if (network) | 305 if (network) |
| 304 NET_LOG_EVENT("SetConnectingNetwork", GetManagedStateLogName(network)); | 306 NET_LOG_EVENT("SetConnectingNetwork", GetManagedStateLogName(network)); |
| 305 else | 307 else |
| 306 NET_LOG_ERROR("SetConnectingNetwork to unknown network", service_path); | 308 NET_LOG_ERROR("SetConnectingNetwork to unknown network", service_path); |
| 307 } | 309 } |
| 308 | 310 |
| 311 void NetworkStateHandler::SetCheckPortalList( |
| 312 const std::string& check_portal_list) { |
| 313 NET_LOG_EVENT("SetCheckPortalList", check_portal_list); |
| 314 shill_property_handler_->SetCheckPortalList(check_portal_list); |
| 315 } |
| 316 |
| 309 void NetworkStateHandler::GetNetworkStatePropertiesForTest( | 317 void NetworkStateHandler::GetNetworkStatePropertiesForTest( |
| 310 base::DictionaryValue* dictionary) const { | 318 base::DictionaryValue* dictionary) const { |
| 311 for (ManagedStateList::const_iterator iter = network_list_.begin(); | 319 for (ManagedStateList::const_iterator iter = network_list_.begin(); |
| 312 iter != network_list_.end(); ++iter) { | 320 iter != network_list_.end(); ++iter) { |
| 313 base::DictionaryValue* network_dict = new base::DictionaryValue; | 321 base::DictionaryValue* network_dict = new base::DictionaryValue; |
| 314 (*iter)->AsNetworkState()->GetProperties(network_dict); | 322 (*iter)->AsNetworkState()->GetProperties(network_dict); |
| 315 dictionary->SetWithoutPathExpansion((*iter)->path(), network_dict); | 323 dictionary->SetWithoutPathExpansion((*iter)->path(), network_dict); |
| 316 } | 324 } |
| 317 } | 325 } |
| 318 | 326 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 detail += " = " + network_event_log::ValueAsString(value); | 462 detail += " = " + network_event_log::ValueAsString(value); |
| 455 NET_LOG_EVENT("DevicePropertyUpdated", detail); | 463 NET_LOG_EVENT("DevicePropertyUpdated", detail); |
| 456 | 464 |
| 457 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, | 465 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, |
| 458 DeviceListChanged()); | 466 DeviceListChanged()); |
| 459 | 467 |
| 460 if (key == flimflam::kScanningProperty && device->scanning() == false) | 468 if (key == flimflam::kScanningProperty && device->scanning() == false) |
| 461 ScanCompleted(device->type()); | 469 ScanCompleted(device->type()); |
| 462 } | 470 } |
| 463 | 471 |
| 472 void NetworkStateHandler::CheckPortalListChanged( |
| 473 const std::string& check_portal_list) { |
| 474 check_portal_list_ = check_portal_list; |
| 475 } |
| 476 |
| 464 void NetworkStateHandler::NotifyManagerPropertyChanged() { | 477 void NetworkStateHandler::NotifyManagerPropertyChanged() { |
| 465 NET_LOG_DEBUG("NotifyManagerPropertyChanged", ""); | 478 NET_LOG_DEBUG("NotifyManagerPropertyChanged", ""); |
| 466 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, | 479 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, |
| 467 NetworkManagerChanged()); | 480 NetworkManagerChanged()); |
| 468 } | 481 } |
| 469 | 482 |
| 470 void NetworkStateHandler::ManagedStateListChanged( | 483 void NetworkStateHandler::ManagedStateListChanged( |
| 471 ManagedState::ManagedType type) { | 484 ManagedState::ManagedType type) { |
| 472 if (type == ManagedState::MANAGED_TYPE_NETWORK) { | 485 if (type == ManagedState::MANAGED_TYPE_NETWORK) { |
| 473 // Notify observers that the list of networks has changed. | 486 // Notify observers that the list of networks has changed. |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 } | 616 } |
| 604 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || | 617 if (type == kMatchTypeDefault || type == kMatchTypeNonVirtual || |
| 605 type == kMatchTypeWireless) { | 618 type == kMatchTypeWireless) { |
| 606 NOTREACHED(); | 619 NOTREACHED(); |
| 607 return flimflam::kTypeWifi; | 620 return flimflam::kTypeWifi; |
| 608 } | 621 } |
| 609 return type; | 622 return type; |
| 610 } | 623 } |
| 611 | 624 |
| 612 } // namespace chromeos | 625 } // namespace chromeos |
| OLD | NEW |