| 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/guid.h" | 9 #include "base/guid.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 } // namespace | 57 } // namespace |
| 58 | 58 |
| 59 const char NetworkStateHandler::kDefaultCheckPortalList[] = | 59 const char NetworkStateHandler::kDefaultCheckPortalList[] = |
| 60 "ethernet,wifi,cellular"; | 60 "ethernet,wifi,cellular"; |
| 61 | 61 |
| 62 NetworkStateHandler::NetworkStateHandler() { | 62 NetworkStateHandler::NetworkStateHandler() { |
| 63 } | 63 } |
| 64 | 64 |
| 65 NetworkStateHandler::~NetworkStateHandler() { | 65 NetworkStateHandler::~NetworkStateHandler() { |
| 66 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, IsShuttingDown()); |
| 66 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); | 67 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); |
| 67 STLDeleteContainerPointers(favorite_list_.begin(), favorite_list_.end()); | 68 STLDeleteContainerPointers(favorite_list_.begin(), favorite_list_.end()); |
| 68 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); | 69 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 void NetworkStateHandler::InitShillPropertyHandler() { | 72 void NetworkStateHandler::InitShillPropertyHandler() { |
| 72 shill_property_handler_.reset(new internal::ShillPropertyHandler(this)); | 73 shill_property_handler_.reset(new internal::ShillPropertyHandler(this)); |
| 73 shill_property_handler_->Init(); | 74 shill_property_handler_->Init(); |
| 74 } | 75 } |
| 75 | 76 |
| (...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 void NetworkStateHandler::UpdateIPConfigProperties( | 674 void NetworkStateHandler::UpdateIPConfigProperties( |
| 674 ManagedState::ManagedType type, | 675 ManagedState::ManagedType type, |
| 675 const std::string& path, | 676 const std::string& path, |
| 676 const std::string& ip_config_path, | 677 const std::string& ip_config_path, |
| 677 const base::DictionaryValue& properties) { | 678 const base::DictionaryValue& properties) { |
| 678 if (type == ManagedState::MANAGED_TYPE_NETWORK) { | 679 if (type == ManagedState::MANAGED_TYPE_NETWORK) { |
| 679 NetworkState* network = GetModifiableNetworkState(path); | 680 NetworkState* network = GetModifiableNetworkState(path); |
| 680 if (!network) | 681 if (!network) |
| 681 return; | 682 return; |
| 682 network->IPConfigPropertiesChanged(properties); | 683 network->IPConfigPropertiesChanged(properties); |
| 684 if (network->path() == default_network_path_) |
| 685 NotifyDefaultNetworkChanged(network); |
| 683 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { | 686 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { |
| 684 DeviceState* device = GetModifiableDeviceState(path); | 687 DeviceState* device = GetModifiableDeviceState(path); |
| 685 if (!device) | 688 if (!device) |
| 686 return; | 689 return; |
| 687 device->IPConfigPropertiesChanged(ip_config_path, properties); | 690 device->IPConfigPropertiesChanged(ip_config_path, properties); |
| 691 if (!default_network_path_.empty()) { |
| 692 const NetworkState* default_network = |
| 693 GetNetworkState(default_network_path_); |
| 694 if (default_network && default_network->device_path() == path) |
| 695 NotifyDefaultNetworkChanged(default_network); |
| 696 } |
| 688 } | 697 } |
| 689 } | 698 } |
| 690 | 699 |
| 691 void NetworkStateHandler::CheckPortalListChanged( | 700 void NetworkStateHandler::CheckPortalListChanged( |
| 692 const std::string& check_portal_list) { | 701 const std::string& check_portal_list) { |
| 693 check_portal_list_ = check_portal_list; | 702 check_portal_list_ = check_portal_list; |
| 694 } | 703 } |
| 695 | 704 |
| 696 void NetworkStateHandler::TechnologyListChanged() { | 705 void NetworkStateHandler::TechnologyListChanged() { |
| 697 // Eventually we would like to replace Technology state with Device state. | 706 // Eventually we would like to replace Technology state with Device state. |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 if (type.MatchesType(shill::kTypeBluetooth)) | 970 if (type.MatchesType(shill::kTypeBluetooth)) |
| 962 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 971 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
| 963 if (type.MatchesType(shill::kTypeVPN)) | 972 if (type.MatchesType(shill::kTypeVPN)) |
| 964 technologies.push_back(new std::string(shill::kTypeVPN)); | 973 technologies.push_back(new std::string(shill::kTypeVPN)); |
| 965 | 974 |
| 966 CHECK_GT(technologies.size(), 0ul); | 975 CHECK_GT(technologies.size(), 0ul); |
| 967 return technologies.Pass(); | 976 return technologies.Pass(); |
| 968 } | 977 } |
| 969 | 978 |
| 970 } // namespace chromeos | 979 } // namespace chromeos |
| OLD | NEW |