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

Side by Side Diff: chrome/browser/android/feedback/connectivity_checker.cc

Issue 1326763009: jni: Forbid inappropriate JNI parameter conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN-only mojo, and chromecast Created 5 years, 3 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 // 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
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
OLDNEW
« no previous file with comments | « base/android/scoped_java_ref.h ('k') | chrome/browser/android/preferences/website_preference_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698