| OLD | NEW |
| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void Start() override; | 59 void Start() override; |
| 60 void Stop() override; | 60 void Stop() override; |
| 61 | 61 |
| 62 rtc::NetworkBindingResult BindSocketToNetwork( | 62 rtc::NetworkBindingResult BindSocketToNetwork( |
| 63 int socket_fd, | 63 int socket_fd, |
| 64 const rtc::IPAddress& address) override; | 64 const rtc::IPAddress& address) override; |
| 65 rtc::AdapterType GetAdapterType(const std::string& if_name) override; | 65 rtc::AdapterType GetAdapterType(const std::string& if_name) override; |
| 66 void OnNetworkConnected(const NetworkInformation& network_info); | 66 void OnNetworkConnected(const NetworkInformation& network_info); |
| 67 void OnNetworkDisconnected(NetworkHandle network_handle); | 67 void OnNetworkDisconnected(NetworkHandle network_handle); |
| 68 // Always expected to be called on the network thread. |
| 68 void SetNetworkInfos(const std::vector<NetworkInformation>& network_infos); | 69 void SetNetworkInfos(const std::vector<NetworkInformation>& network_infos); |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 static jobject application_context_; | 72 static jobject application_context_; |
| 72 static int android_sdk_int_; | 73 static int android_sdk_int_; |
| 73 JNIEnv* jni() { return AttachCurrentThreadIfNeeded(); } | 74 JNIEnv* jni() { return AttachCurrentThreadIfNeeded(); } |
| 74 | 75 |
| 75 void OnNetworkConnected_w(const NetworkInformation& network_info); | 76 void OnNetworkConnected_w(const NetworkInformation& network_info); |
| 76 void OnNetworkDisconnected_w(NetworkHandle network_handle); | 77 void OnNetworkDisconnected_w(NetworkHandle network_handle); |
| 77 | 78 |
| 78 ScopedGlobalRef<jclass> j_network_monitor_class_; | 79 ScopedGlobalRef<jclass> j_network_monitor_class_; |
| 79 ScopedGlobalRef<jobject> j_network_monitor_; | 80 ScopedGlobalRef<jobject> j_network_monitor_; |
| 80 rtc::ThreadChecker thread_checker_; | 81 rtc::ThreadChecker thread_checker_; |
| 81 bool started_ = false; | 82 bool started_ = false; |
| 82 std::map<std::string, rtc::AdapterType> adapter_type_by_name_; | 83 std::map<std::string, rtc::AdapterType> adapter_type_by_name_; |
| 83 std::map<rtc::IPAddress, NetworkHandle> network_handle_by_address_; | 84 std::map<rtc::IPAddress, NetworkHandle> network_handle_by_address_; |
| 84 std::map<NetworkHandle, NetworkInformation> network_info_by_handle_; | 85 std::map<NetworkHandle, NetworkInformation> network_info_by_handle_; |
| 85 }; | 86 }; |
| 86 | 87 |
| 87 class AndroidNetworkMonitorFactory : public rtc::NetworkMonitorFactory { | 88 class AndroidNetworkMonitorFactory : public rtc::NetworkMonitorFactory { |
| 88 public: | 89 public: |
| 89 AndroidNetworkMonitorFactory() {} | 90 AndroidNetworkMonitorFactory() {} |
| 90 | 91 |
| 91 rtc::NetworkMonitorInterface* CreateNetworkMonitor() override; | 92 rtc::NetworkMonitorInterface* CreateNetworkMonitor() override; |
| 92 }; | 93 }; |
| 93 | 94 |
| 94 } // namespace webrtc_jni | 95 } // namespace webrtc_jni |
| 95 | 96 |
| 96 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_ANDROIDNETWORKMONITOR_JNI_H_ | 97 #endif // WEBRTC_SDK_ANDROID_SRC_JNI_ANDROIDNETWORKMONITOR_JNI_H_ |
| OLD | NEW |