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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 void NetworkStateHandler::SetTechnologyEnabled( | 117 void NetworkStateHandler::SetTechnologyEnabled( |
118 const NetworkTypePattern& type, | 118 const NetworkTypePattern& type, |
119 bool enabled, | 119 bool enabled, |
120 const network_handler::ErrorCallback& error_callback) { | 120 const network_handler::ErrorCallback& error_callback) { |
121 ScopedVector<std::string> technologies = GetTechnologiesForType(type); | 121 ScopedVector<std::string> technologies = GetTechnologiesForType(type); |
122 for (ScopedVector<std::string>::iterator it = technologies.begin(); | 122 for (ScopedVector<std::string>::iterator it = technologies.begin(); |
123 it != technologies.end(); ++it) { | 123 it != technologies.end(); ++it) { |
124 std::string* technology = *it; | 124 std::string* technology = *it; |
125 DCHECK(technology); | 125 DCHECK(technology); |
| 126 if (!shill_property_handler_->IsTechnologyAvailable(*technology)) |
| 127 continue; |
126 NET_LOG_USER("SetTechnologyEnabled", | 128 NET_LOG_USER("SetTechnologyEnabled", |
127 base::StringPrintf("%s:%d", technology->c_str(), enabled)); | 129 base::StringPrintf("%s:%d", technology->c_str(), enabled)); |
128 shill_property_handler_->SetTechnologyEnabled( | 130 shill_property_handler_->SetTechnologyEnabled( |
129 *technology, enabled, error_callback); | 131 *technology, enabled, error_callback); |
130 } | 132 } |
131 // Signal Device/Technology state changed. | 133 // Signal Device/Technology state changed. |
132 NotifyDeviceListChanged(); | 134 NotifyDeviceListChanged(); |
133 } | 135 } |
134 | 136 |
135 const DeviceState* NetworkStateHandler::GetDeviceState( | 137 const DeviceState* NetworkStateHandler::GetDeviceState( |
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 if (type.MatchesType(shill::kTypeBluetooth)) | 912 if (type.MatchesType(shill::kTypeBluetooth)) |
911 technologies.push_back(new std::string(shill::kTypeBluetooth)); | 913 technologies.push_back(new std::string(shill::kTypeBluetooth)); |
912 if (type.MatchesType(shill::kTypeVPN)) | 914 if (type.MatchesType(shill::kTypeVPN)) |
913 technologies.push_back(new std::string(shill::kTypeVPN)); | 915 technologies.push_back(new std::string(shill::kTypeVPN)); |
914 | 916 |
915 CHECK_GT(technologies.size(), 0ul); | 917 CHECK_GT(technologies.size(), 0ul); |
916 return technologies.Pass(); | 918 return technologies.Pass(); |
917 } | 919 } |
918 | 920 |
919 } // namespace chromeos | 921 } // namespace chromeos |
OLD | NEW |