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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 ip_address_ = default_network->ip_address(); | 192 ip_address_ = default_network->ip_address(); |
193 dns_servers_ = default_network->dns_servers(); | 193 dns_servers_ = default_network->dns_servers(); |
194 } | 194 } |
195 | 195 |
196 // static | 196 // static |
197 net::NetworkChangeNotifier::ConnectionType | 197 net::NetworkChangeNotifier::ConnectionType |
198 NetworkChangeNotifierChromeos::ConnectionTypeFromShill( | 198 NetworkChangeNotifierChromeos::ConnectionTypeFromShill( |
199 const std::string& type, const std::string& technology) { | 199 const std::string& type, const std::string& technology) { |
200 if (NetworkTypePattern::Ethernet().MatchesType(type)) | 200 if (NetworkTypePattern::Ethernet().MatchesType(type)) |
201 return CONNECTION_ETHERNET; | 201 return CONNECTION_ETHERNET; |
202 else if (type == flimflam::kTypeWifi) | 202 else if (type == shill::kTypeWifi) |
203 return CONNECTION_WIFI; | 203 return CONNECTION_WIFI; |
204 else if (type == flimflam::kTypeWimax) | 204 else if (type == shill::kTypeWimax) |
205 return CONNECTION_4G; | 205 return CONNECTION_4G; |
206 | 206 |
207 if (type != flimflam::kTypeCellular) | 207 if (type != shill::kTypeCellular) |
208 return CONNECTION_UNKNOWN; | 208 return CONNECTION_UNKNOWN; |
209 | 209 |
210 // For cellular types, mapping depends on the technology. | 210 // For cellular types, mapping depends on the technology. |
211 if (technology == flimflam::kNetworkTechnologyEvdo || | 211 if (technology == shill::kNetworkTechnologyEvdo || |
212 technology == flimflam::kNetworkTechnologyGsm || | 212 technology == shill::kNetworkTechnologyGsm || |
213 technology == flimflam::kNetworkTechnologyUmts || | 213 technology == shill::kNetworkTechnologyUmts || |
214 technology == flimflam::kNetworkTechnologyHspa) { | 214 technology == shill::kNetworkTechnologyHspa) { |
215 return CONNECTION_3G; | 215 return CONNECTION_3G; |
216 } else if (technology == flimflam::kNetworkTechnologyHspaPlus || | 216 } else if (technology == shill::kNetworkTechnologyHspaPlus || |
217 technology == flimflam::kNetworkTechnologyLte || | 217 technology == shill::kNetworkTechnologyLte || |
218 technology == flimflam::kNetworkTechnologyLteAdvanced) { | 218 technology == shill::kNetworkTechnologyLteAdvanced) { |
219 return CONNECTION_4G; | 219 return CONNECTION_4G; |
220 } else { | 220 } else { |
221 return CONNECTION_2G; // Default cellular type is 2G. | 221 return CONNECTION_2G; // Default cellular type is 2G. |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 // static | 225 // static |
226 net::NetworkChangeNotifier::NetworkChangeCalculatorParams | 226 net::NetworkChangeNotifier::NetworkChangeCalculatorParams |
227 NetworkChangeNotifierChromeos::NetworkChangeCalculatorParamsChromeos() { | 227 NetworkChangeNotifierChromeos::NetworkChangeCalculatorParamsChromeos() { |
228 NetworkChangeCalculatorParams params; | 228 NetworkChangeCalculatorParams params; |
229 // Delay values arrived at by simple experimentation and adjusted so as to | 229 // Delay values arrived at by simple experimentation and adjusted so as to |
230 // produce a single signal when switching between network connections. | 230 // produce a single signal when switching between network connections. |
231 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000); | 231 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000); |
232 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000); | 232 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000); |
233 params.connection_type_offline_delay_ = | 233 params.connection_type_offline_delay_ = |
234 base::TimeDelta::FromMilliseconds(500); | 234 base::TimeDelta::FromMilliseconds(500); |
235 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); | 235 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); |
236 return params; | 236 return params; |
237 } | 237 } |
238 | 238 |
239 } // namespace chromeos | 239 } // namespace chromeos |
OLD | NEW |