[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 1 | // Copyright 2014 The Chromium Authors. All rights reserved. |
2 | // Use of this source code is governed by a BSD-style license that can be | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #include "content/renderer/net_info_helper.h" | ||||
6 | |||||
7 | namespace content { | ||||
8 | |||||
9 | blink::WebConnectionType | ||||
10 | NetConnectionTypeToWebConnectionType( | ||||
11 | net::NetworkChangeNotifier::ConnectionType net_type) { | ||||
12 | switch (net_type) { | ||||
13 | case net::NetworkChangeNotifier::CONNECTION_UNKNOWN: | ||||
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 14 | return blink::WebConnectionTypeUnknown; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 15 | case net::NetworkChangeNotifier::CONNECTION_ETHERNET: |
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 16 | return blink::WebConnectionTypeEthernet; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 17 | case net::NetworkChangeNotifier::CONNECTION_WIFI: |
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 18 | return blink::WebConnectionTypeWifi; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 19 | case net::NetworkChangeNotifier::CONNECTION_NONE: |
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 20 | return blink::WebConnectionTypeNone; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 21 | case net::NetworkChangeNotifier::CONNECTION_2G: |
22 | case net::NetworkChangeNotifier::CONNECTION_3G: | ||||
23 | case net::NetworkChangeNotifier::CONNECTION_4G: | ||||
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 24 | return blink::WebConnectionTypeCellular; |
[email protected] | 078cab2 | 2014-06-04 14:08:40 | [diff] [blame] | 25 | case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: |
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 26 | return blink::WebConnectionTypeBluetooth; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 27 | } |
28 | |||||
29 | NOTREACHED(); | ||||
jkarlin | 3e18bda | 2015-09-10 23:34:13 | [diff] [blame^] | 30 | return blink::WebConnectionTypeNone; |
[email protected] | d7ff5fb | 2014-05-29 19:50:25 | [diff] [blame] | 31 | } |
32 | |||||
33 | } // namespace content |