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/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 void NetworkStateHandler::SetTechnologyEnabled( | 126 void NetworkStateHandler::SetTechnologyEnabled( |
127 const NetworkTypePattern& type, | 127 const NetworkTypePattern& type, |
128 bool enabled, | 128 bool enabled, |
129 const network_handler::ErrorCallback& error_callback) { | 129 const network_handler::ErrorCallback& error_callback) { |
130 ScopedVector<std::string> technologies = GetTechnologiesForType(type); | 130 ScopedVector<std::string> technologies = GetTechnologiesForType(type); |
131 for (ScopedVector<std::string>::iterator it = technologies.begin(); | 131 for (ScopedVector<std::string>::iterator it = technologies.begin(); |
132 it != technologies.end(); ++it) { | 132 it != technologies.end(); ++it) { |
133 std::string* technology = *it; | 133 std::string* technology = *it; |
134 DCHECK(technology); | 134 DCHECK(technology); |
| 135 if (!shill_property_handler_->IsTechnologyAvailable(*technology)) |
| 136 continue; |
135 NET_LOG_USER("SetTechnologyEnabled", | 137 NET_LOG_USER("SetTechnologyEnabled", |
136 base::StringPrintf("%s:%d", technology->c_str(), enabled)); | 138 base::StringPrintf("%s:%d", technology->c_str(), enabled)); |
137 shill_property_handler_->SetTechnologyEnabled( | 139 shill_property_handler_->SetTechnologyEnabled( |
138 *technology, enabled, error_callback); | 140 *technology, enabled, error_callback); |
139 } | 141 } |
140 // Signal Device/Technology state changed. | 142 // Signal Device/Technology state changed. |
141 NotifyDeviceListChanged(); | 143 NotifyDeviceListChanged(); |
142 } | 144 } |
143 | 145 |
144 const DeviceState* NetworkStateHandler::GetDeviceState( | 146 const DeviceState* NetworkStateHandler::GetDeviceState( |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 if (type.MatchesType(shill::kTypeBluetooth)) | 864 if (type.MatchesType(shill::kTypeBluetooth)) |
863 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 865 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
864 if (type.MatchesType(shill::kTypeVPN)) | 866 if (type.MatchesType(shill::kTypeVPN)) |
865 technologies.push_back(new std::string(shill::kTypeVPN)); | 867 technologies.push_back(new std::string(shill::kTypeVPN)); |
866 | 868 |
867 CHECK_GT(technologies.size(), 0ul); | 869 CHECK_GT(technologies.size(), 0ul); |
868 return technologies.Pass(); | 870 return technologies.Pass(); |
869 } | 871 } |
870 | 872 |
871 } // namespace chromeos | 873 } // namespace chromeos |
OLD | NEW |