OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/feedback/connectivity_checker.h" | 5 #include "chrome/browser/android/feedback/connectivity_checker.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 176 } |
177 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); | 177 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); |
178 if (!url.is_valid()) { | 178 if (!url.is_valid()) { |
179 PostCallback(env, j_callback, CONNECTIVITY_CHECK_RESULT_ERROR); | 179 PostCallback(env, j_callback, CONNECTIVITY_CHECK_RESULT_ERROR); |
180 return; | 180 return; |
181 } | 181 } |
182 | 182 |
183 // This object will be deleted when the connectivity check has completed. | 183 // This object will be deleted when the connectivity check has completed. |
184 ConnectivityChecker* connectivity_checker = new ConnectivityChecker( | 184 ConnectivityChecker* connectivity_checker = new ConnectivityChecker( |
185 profile, url, base::TimeDelta::FromMilliseconds(j_timeout_ms), | 185 profile, url, base::TimeDelta::FromMilliseconds(j_timeout_ms), |
186 base::android::ScopedJavaLocalRef<jobject>(env, j_callback)); | 186 j_callback); |
187 connectivity_checker->StartAsyncCheck(); | 187 connectivity_checker->StartAsyncCheck(); |
188 } | 188 } |
189 | 189 |
190 jboolean IsUrlValid(JNIEnv* env, | 190 jboolean IsUrlValid(JNIEnv* env, |
191 const JavaParamRef<jclass>& clazz, | 191 const JavaParamRef<jclass>& clazz, |
192 const JavaParamRef<jstring>& j_url) { | 192 const JavaParamRef<jstring>& j_url) { |
193 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); | 193 GURL url(base::android::ConvertJavaStringToUTF8(env, j_url)); |
194 return url.is_valid(); | 194 return url.is_valid(); |
195 } | 195 } |
196 | 196 |
197 bool RegisterConnectivityChecker(JNIEnv* env) { | 197 bool RegisterConnectivityChecker(JNIEnv* env) { |
198 return RegisterNativesImpl(env); | 198 return RegisterNativesImpl(env); |
199 } | 199 } |
200 | 200 |
201 } // namespace android | 201 } // namespace android |
202 } // namespace chrome | 202 } // namespace chrome |
OLD | NEW |