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

Side by Side Diff: webrtc/api/java/jni/androidnetworkmonitor_jni.cc

Issue 2112963002: Add UNKNOWN_CELLULAR network type and allow unknown network type in NetworkMonitor (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: . Created 4 years, 5 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
« no previous file with comments | « webrtc/api/java/jni/androidnetworkmonitor_jni.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 26 matching lines...) Expand all
37 } 37 }
38 if (enum_name == "CONNECTION_4G") { 38 if (enum_name == "CONNECTION_4G") {
39 return NetworkType::NETWORK_4G; 39 return NetworkType::NETWORK_4G;
40 } 40 }
41 if (enum_name == "CONNECTION_3G") { 41 if (enum_name == "CONNECTION_3G") {
42 return NetworkType::NETWORK_3G; 42 return NetworkType::NETWORK_3G;
43 } 43 }
44 if (enum_name == "CONNECTION_2G") { 44 if (enum_name == "CONNECTION_2G") {
45 return NetworkType::NETWORK_2G; 45 return NetworkType::NETWORK_2G;
46 } 46 }
47 if (enum_name == "CONNECTION_UNKNOWN_CELLULAR") {
48 return NetworkType::NETWORK_UNKNOWN_CELLULAR;
49 }
47 if (enum_name == "CONNECTION_BLUETOOTH") { 50 if (enum_name == "CONNECTION_BLUETOOTH") {
48 return NetworkType::NETWORK_BLUETOOTH; 51 return NetworkType::NETWORK_BLUETOOTH;
49 } 52 }
50 if (enum_name == "CONNECTION_NONE") { 53 if (enum_name == "CONNECTION_NONE") {
51 return NetworkType::NETWORK_NONE; 54 return NetworkType::NETWORK_NONE;
52 } 55 }
53 ASSERT(false); 56 ASSERT(false);
54 return NetworkType::NETWORK_UNKNOWN; 57 return NetworkType::NETWORK_UNKNOWN;
55 } 58 }
56 59
57 static rtc::AdapterType AdapterTypeFromNetworkType(NetworkType network_type) { 60 static rtc::AdapterType AdapterTypeFromNetworkType(NetworkType network_type) {
58 switch (network_type) { 61 switch (network_type) {
59 case NETWORK_UNKNOWN: 62 case NETWORK_UNKNOWN:
60 RTC_DCHECK(false) << "Unknown network type";
61 return rtc::ADAPTER_TYPE_UNKNOWN; 63 return rtc::ADAPTER_TYPE_UNKNOWN;
62 case NETWORK_ETHERNET: 64 case NETWORK_ETHERNET:
63 return rtc::ADAPTER_TYPE_ETHERNET; 65 return rtc::ADAPTER_TYPE_ETHERNET;
64 case NETWORK_WIFI: 66 case NETWORK_WIFI:
65 return rtc::ADAPTER_TYPE_WIFI; 67 return rtc::ADAPTER_TYPE_WIFI;
66 case NETWORK_4G: 68 case NETWORK_4G:
67 case NETWORK_3G: 69 case NETWORK_3G:
68 case NETWORK_2G: 70 case NETWORK_2G:
71 case NETWORK_UNKNOWN_CELLULAR:
69 return rtc::ADAPTER_TYPE_CELLULAR; 72 return rtc::ADAPTER_TYPE_CELLULAR;
70 case NETWORK_BLUETOOTH: 73 case NETWORK_BLUETOOTH:
71 // There is no corresponding mapping for bluetooth networks. 74 // There is no corresponding mapping for bluetooth networks.
72 // Map it to VPN for now. 75 // Map it to VPN for now.
73 return rtc::ADAPTER_TYPE_VPN; 76 return rtc::ADAPTER_TYPE_VPN;
74 default: 77 default:
75 RTC_DCHECK(false) << "Invalid network type " << network_type; 78 RTC_DCHECK(false) << "Invalid network type " << network_type;
76 return rtc::ADAPTER_TYPE_UNKNOWN; 79 return rtc::ADAPTER_TYPE_UNKNOWN;
77 } 80 }
78 } 81 }
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( 370 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)(
368 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, 371 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor,
369 jint network_handle) { 372 jint network_handle) {
370 AndroidNetworkMonitor* network_monitor = 373 AndroidNetworkMonitor* network_monitor =
371 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); 374 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor);
372 network_monitor->OnNetworkDisconnected( 375 network_monitor->OnNetworkDisconnected(
373 static_cast<NetworkHandle>(network_handle)); 376 static_cast<NetworkHandle>(network_handle));
374 } 377 }
375 378
376 } // namespace webrtc_jni 379 } // namespace webrtc_jni
OLDNEW
« no previous file with comments | « webrtc/api/java/jni/androidnetworkmonitor_jni.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698