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

Side by Side Diff: talk/app/webrtc/java/jni/androidnetworkmonitor_jni.h

Issue 1594673002: Get the adapter type information from Android OS. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 4 years, 10 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
OLDNEW
1 /* 1 /*
2 * libjingle 2 * libjingle
3 * Copyright 2015 Google Inc. 3 * Copyright 2015 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 public: 68 public:
69 AndroidNetworkMonitor(); 69 AndroidNetworkMonitor();
70 70
71 static void SetAndroidContext(JNIEnv* jni, jobject context); 71 static void SetAndroidContext(JNIEnv* jni, jobject context);
72 72
73 void Start() override; 73 void Start() override;
74 void Stop() override; 74 void Stop() override;
75 75
76 int BindSocketToNetwork(int socket_fd, 76 int BindSocketToNetwork(int socket_fd,
77 const rtc::IPAddress& address) override; 77 const rtc::IPAddress& address) override;
78 void OnNetworkAvailable(const NetworkInformation& network_info); 78 rtc::AdapterType GetAdapterType(const std::string& if_name) override;
79 void OnNetworkConnected(const NetworkInformation& network_info);
80 void OnNetworkDisconnected(NetworkHandle network_handle);
81 void SetNetworkInfos(const std::vector<NetworkInformation>& network_infos);
79 82
80 private: 83 private:
81 JNIEnv* jni() { return AttachCurrentThreadIfNeeded(); } 84 JNIEnv* jni() { return AttachCurrentThreadIfNeeded(); }
82 85
83 void OnNetworkAvailable_w(const NetworkInformation& network_info); 86 void OnNetworkConnected_w(const NetworkInformation& network_info);
87 void OnNetworkDisconnected_w(NetworkHandle network_handle);
84 88
85 ScopedGlobalRef<jclass> j_network_monitor_class_; 89 ScopedGlobalRef<jclass> j_network_monitor_class_;
86 ScopedGlobalRef<jobject> j_network_monitor_; 90 ScopedGlobalRef<jobject> j_network_monitor_;
87 rtc::ThreadChecker thread_checker_; 91 rtc::ThreadChecker thread_checker_;
88 static jobject application_context_; 92 static jobject application_context_;
89 bool started_ = false; 93 bool started_ = false;
90 std::map<rtc::IPAddress, NetworkInformation> network_info_by_address_; 94 std::map<std::string, rtc::AdapterType> adapter_type_by_name_;
95 std::map<rtc::IPAddress, NetworkHandle> network_handle_by_address_;
96 std::map<NetworkHandle, NetworkInformation> network_info_by_handle_;
91 }; 97 };
92 98
93 class AndroidNetworkMonitorFactory : public rtc::NetworkMonitorFactory { 99 class AndroidNetworkMonitorFactory : public rtc::NetworkMonitorFactory {
94 public: 100 public:
95 AndroidNetworkMonitorFactory() {} 101 AndroidNetworkMonitorFactory() {}
96 102
97 rtc::NetworkMonitorInterface* CreateNetworkMonitor() override; 103 rtc::NetworkMonitorInterface* CreateNetworkMonitor() override;
98 }; 104 };
99 105
100 } // namespace webrtc_jni 106 } // namespace webrtc_jni
101 107
102 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDNETWORKMONITOR_JNI_H_ 108 #endif // TALK_APP_WEBRTC_JAVA_JNI_ANDROIDNETWORKMONITOR_JNI_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698