| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 const char NetworkStateHandler::kDefaultCheckPortalList[] = | 56 const char NetworkStateHandler::kDefaultCheckPortalList[] = |
| 57 "ethernet,wifi,cellular"; | 57 "ethernet,wifi,cellular"; |
| 58 | 58 |
| 59 NetworkStateHandler::NetworkStateHandler() { | 59 NetworkStateHandler::NetworkStateHandler() { |
| 60 } | 60 } |
| 61 | 61 |
| 62 NetworkStateHandler::~NetworkStateHandler() { | 62 NetworkStateHandler::~NetworkStateHandler() { |
| 63 FOR_EACH_OBSERVER(NetworkStateHandlerObserver, observers_, IsShuttingDown()); |
| 63 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); | 64 STLDeleteContainerPointers(network_list_.begin(), network_list_.end()); |
| 64 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); | 65 STLDeleteContainerPointers(device_list_.begin(), device_list_.end()); |
| 65 } | 66 } |
| 66 | 67 |
| 67 void NetworkStateHandler::InitShillPropertyHandler() { | 68 void NetworkStateHandler::InitShillPropertyHandler() { |
| 68 shill_property_handler_.reset(new internal::ShillPropertyHandler(this)); | 69 shill_property_handler_.reset(new internal::ShillPropertyHandler(this)); |
| 69 shill_property_handler_->Init(); | 70 shill_property_handler_->Init(); |
| 70 } | 71 } |
| 71 | 72 |
| 72 // static | 73 // static |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 void NetworkStateHandler::UpdateIPConfigProperties( | 652 void NetworkStateHandler::UpdateIPConfigProperties( |
| 652 ManagedState::ManagedType type, | 653 ManagedState::ManagedType type, |
| 653 const std::string& path, | 654 const std::string& path, |
| 654 const std::string& ip_config_path, | 655 const std::string& ip_config_path, |
| 655 const base::DictionaryValue& properties) { | 656 const base::DictionaryValue& properties) { |
| 656 if (type == ManagedState::MANAGED_TYPE_NETWORK) { | 657 if (type == ManagedState::MANAGED_TYPE_NETWORK) { |
| 657 NetworkState* network = GetModifiableNetworkState(path); | 658 NetworkState* network = GetModifiableNetworkState(path); |
| 658 if (!network) | 659 if (!network) |
| 659 return; | 660 return; |
| 660 network->IPConfigPropertiesChanged(properties); | 661 network->IPConfigPropertiesChanged(properties); |
| 662 if (network->path() == default_network_path_) |
| 663 NotifyDefaultNetworkChanged(network); |
| 661 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { | 664 } else if (type == ManagedState::MANAGED_TYPE_DEVICE) { |
| 662 DeviceState* device = GetModifiableDeviceState(path); | 665 DeviceState* device = GetModifiableDeviceState(path); |
| 663 if (!device) | 666 if (!device) |
| 664 return; | 667 return; |
| 665 device->IPConfigPropertiesChanged(ip_config_path, properties); | 668 device->IPConfigPropertiesChanged(ip_config_path, properties); |
| 669 if (!default_network_path_.empty()) { |
| 670 const NetworkState* default_network = |
| 671 GetNetworkState(default_network_path_); |
| 672 if (default_network && default_network->device_path() == path) |
| 673 NotifyDefaultNetworkChanged(default_network); |
| 674 } |
| 666 } | 675 } |
| 667 } | 676 } |
| 668 | 677 |
| 669 void NetworkStateHandler::CheckPortalListChanged( | 678 void NetworkStateHandler::CheckPortalListChanged( |
| 670 const std::string& check_portal_list) { | 679 const std::string& check_portal_list) { |
| 671 check_portal_list_ = check_portal_list; | 680 check_portal_list_ = check_portal_list; |
| 672 } | 681 } |
| 673 | 682 |
| 674 void NetworkStateHandler::TechnologyListChanged() { | 683 void NetworkStateHandler::TechnologyListChanged() { |
| 675 // Eventually we would like to replace Technology state with Device state. | 684 // Eventually we would like to replace Technology state with Device state. |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 910 if (type.MatchesType(shill::kTypeBluetooth)) | 919 if (type.MatchesType(shill::kTypeBluetooth)) |
| 911 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 920 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
| 912 if (type.MatchesType(shill::kTypeVPN)) | 921 if (type.MatchesType(shill::kTypeVPN)) |
| 913 technologies.push_back(new std::string(shill::kTypeVPN)); | 922 technologies.push_back(new std::string(shill::kTypeVPN)); |
| 914 | 923 |
| 915 CHECK_GT(technologies.size(), 0ul); | 924 CHECK_GT(technologies.size(), 0ul); |
| 916 return technologies.Pass(); | 925 return technologies.Pass(); |
| 917 } | 926 } |
| 918 | 927 |
| 919 } // namespace chromeos | 928 } // namespace chromeos |
| OLD | NEW |