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

Side by Side Diff: android_webview/native/aw_contents_client_bridge.cc

Issue 2295693004: Pass JavaRef to Java methods in android_webview. (Closed)
Patch Set: Created 4 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "android_webview/native/aw_contents_client_bridge.h" 5 #include "android_webview/native/aw_contents_client_bridge.h"
6 6
7 #include "android_webview/common/devtools_instrumentation.h" 7 #include "android_webview/common/devtools_instrumentation.h"
8 #include "android_webview/native/aw_contents.h" 8 #include "android_webview/native/aw_contents.h"
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 void RecordClientCertificateKey( 45 void RecordClientCertificateKey(
46 const scoped_refptr<net::X509Certificate>& client_cert, 46 const scoped_refptr<net::X509Certificate>& client_cert,
47 crypto::ScopedEVP_PKEY private_key) { 47 crypto::ScopedEVP_PKEY private_key) {
48 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 48 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
49 net::OpenSSLClientKeyStore::GetInstance()->RecordClientCertPrivateKey( 49 net::OpenSSLClientKeyStore::GetInstance()->RecordClientCertPrivateKey(
50 client_cert.get(), private_key.get()); 50 client_cert.get(), private_key.get());
51 } 51 }
52 52
53 } // namespace 53 } // namespace
54 54
55 AwContentsClientBridge::AwContentsClientBridge(JNIEnv* env, jobject obj) 55 AwContentsClientBridge::AwContentsClientBridge(JNIEnv* env,
56 const JavaRef<jobject>& obj)
56 : java_ref_(env, obj) { 57 : java_ref_(env, obj) {
57 DCHECK(obj); 58 DCHECK(!obj.is_null());
58 Java_AwContentsClientBridge_setNativeContentsClientBridge( 59 Java_AwContentsClientBridge_setNativeContentsClientBridge(
59 env, obj, reinterpret_cast<intptr_t>(this)); 60 env, obj, reinterpret_cast<intptr_t>(this));
60 } 61 }
61 62
62 AwContentsClientBridge::~AwContentsClientBridge() { 63 AwContentsClientBridge::~AwContentsClientBridge() {
63 JNIEnv* env = AttachCurrentThread(); 64 JNIEnv* env = AttachCurrentThread();
64 65
65 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 66 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
66 if (!obj.is_null()) { 67 if (!obj.is_null()) {
67 // Clear the weak reference from the java peer to the native object since 68 // Clear the weak reference from the java peer to the native object since
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 pending_client_cert_request_delegates_.Remove(request_id); 402 pending_client_cert_request_delegates_.Remove(request_id);
402 403
403 delete delegate; 404 delete delegate;
404 } 405 }
405 406
406 bool RegisterAwContentsClientBridge(JNIEnv* env) { 407 bool RegisterAwContentsClientBridge(JNIEnv* env) {
407 return RegisterNativesImpl(env); 408 return RegisterNativesImpl(env);
408 } 409 }
409 410
410 } // namespace android_webview 411 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents_client_bridge.h ('k') | android_webview/native/aw_contents_client_bridge_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698