Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(952)

Side by Side Diff: chromeos/network/network_change_notifier_chromeos.cc

Issue 23712002: Cleanup network type matching. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unit test in Debug. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chromeos/network/managed_state.cc ('k') | chromeos/network/network_state_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "chromeos/dbus/dbus_thread_manager.h" 11 #include "chromeos/dbus/dbus_thread_manager.h"
12 #include "chromeos/network/network_change_notifier_chromeos.h" 12 #include "chromeos/network/network_change_notifier_chromeos.h"
13 #include "chromeos/network/network_event_log.h" 13 #include "chromeos/network/network_event_log.h"
14 #include "chromeos/network/network_state.h" 14 #include "chromeos/network/network_state.h"
15 #include "chromeos/network/network_state_handler.h" 15 #include "chromeos/network/network_state_handler.h"
16 #include "chromeos/network/shill_property_util.h"
16 #include "net/base/network_change_notifier.h" 17 #include "net/base/network_change_notifier.h"
17 #include "net/dns/dns_config_service_posix.h" 18 #include "net/dns/dns_config_service_posix.h"
18 #include "third_party/cros_system_api/dbus/service_constants.h" 19 #include "third_party/cros_system_api/dbus/service_constants.h"
19 20
20 namespace chromeos { 21 namespace chromeos {
21 22
22 // DNS config services on Chrome OS are signalled by the network state handler 23 // DNS config services on Chrome OS are signalled by the network state handler
23 // rather than relying on watching files in /etc. 24 // rather than relying on watching files in /etc.
24 class NetworkChangeNotifierChromeos::DnsConfigService 25 class NetworkChangeNotifierChromeos::DnsConfigService
25 : public net::internal::DnsConfigServicePosix { 26 : public net::internal::DnsConfigServicePosix {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 connection_type_ = new_connection_type; 190 connection_type_ = new_connection_type;
190 service_path_ = default_network->path(); 191 service_path_ = default_network->path();
191 ip_address_ = default_network->ip_address(); 192 ip_address_ = default_network->ip_address();
192 dns_servers_ = default_network->dns_servers(); 193 dns_servers_ = default_network->dns_servers();
193 } 194 }
194 195
195 // static 196 // static
196 net::NetworkChangeNotifier::ConnectionType 197 net::NetworkChangeNotifier::ConnectionType
197 NetworkChangeNotifierChromeos::ConnectionTypeFromShill( 198 NetworkChangeNotifierChromeos::ConnectionTypeFromShill(
198 const std::string& type, const std::string& technology) { 199 const std::string& type, const std::string& technology) {
199 if (type == flimflam::kTypeEthernet) 200 if (NetworkTypePattern::Ethernet().MatchesType(type))
200 return CONNECTION_ETHERNET; 201 return CONNECTION_ETHERNET;
201 else if (type == flimflam::kTypeWifi) 202 else if (type == flimflam::kTypeWifi)
202 return CONNECTION_WIFI; 203 return CONNECTION_WIFI;
203 else if (type == flimflam::kTypeWimax) 204 else if (type == flimflam::kTypeWimax)
204 return CONNECTION_4G; 205 return CONNECTION_4G;
205 206
206 if (type != flimflam::kTypeCellular) 207 if (type != flimflam::kTypeCellular)
207 return CONNECTION_UNKNOWN; 208 return CONNECTION_UNKNOWN;
208 209
209 // For cellular types, mapping depends on the technology. 210 // For cellular types, mapping depends on the technology.
(...skipping 19 matching lines...) Expand all
229 // produce a single signal when switching between network connections. 230 // produce a single signal when switching between network connections.
230 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000); 231 params.ip_address_offline_delay_ = base::TimeDelta::FromMilliseconds(4000);
231 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000); 232 params.ip_address_online_delay_ = base::TimeDelta::FromMilliseconds(1000);
232 params.connection_type_offline_delay_ = 233 params.connection_type_offline_delay_ =
233 base::TimeDelta::FromMilliseconds(500); 234 base::TimeDelta::FromMilliseconds(500);
234 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500); 235 params.connection_type_online_delay_ = base::TimeDelta::FromMilliseconds(500);
235 return params; 236 return params;
236 } 237 }
237 238
238 } // namespace chromeos 239 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_state.cc ('k') | chromeos/network/network_state_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698