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

Side by Side Diff: android_webview/native/aw_autofill_client.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
« no previous file with comments | « no previous file | android_webview/native/aw_contents.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_autofill_client.h" 5 #include "android_webview/native/aw_autofill_client.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_content_browser_client.h" 8 #include "android_webview/browser/aw_content_browser_client.h"
9 #include "android_webview/browser/aw_form_database_service.h" 9 #include "android_webview/browser/aw_form_database_service.h"
10 #include "android_webview/native/aw_contents.h" 10 #include "android_webview/native/aw_contents.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // autofill functionality at the java side. The java peer is owned by Java 43 // autofill functionality at the java side. The java peer is owned by Java
44 // AwContents. The native object only maintains a weak ref to it. 44 // AwContents. The native object only maintains a weak ref to it.
45 AwAutofillClient::AwAutofillClient(WebContents* contents) 45 AwAutofillClient::AwAutofillClient(WebContents* contents)
46 : web_contents_(contents), save_form_data_(false) { 46 : web_contents_(contents), save_form_data_(false) {
47 JNIEnv* env = AttachCurrentThread(); 47 JNIEnv* env = AttachCurrentThread();
48 ScopedJavaLocalRef<jobject> delegate; 48 ScopedJavaLocalRef<jobject> delegate;
49 delegate.Reset( 49 delegate.Reset(
50 Java_AwAutofillClient_create(env, reinterpret_cast<intptr_t>(this))); 50 Java_AwAutofillClient_create(env, reinterpret_cast<intptr_t>(this)));
51 51
52 AwContents* aw_contents = AwContents::FromWebContents(web_contents_); 52 AwContents* aw_contents = AwContents::FromWebContents(web_contents_);
53 aw_contents->SetAwAutofillClient(delegate.obj()); 53 aw_contents->SetAwAutofillClient(delegate);
54 java_ref_ = JavaObjectWeakGlobalRef(env, delegate.obj()); 54 java_ref_ = JavaObjectWeakGlobalRef(env, delegate);
55 } 55 }
56 56
57 AwAutofillClient::~AwAutofillClient() { 57 AwAutofillClient::~AwAutofillClient() {
58 HideAutofillPopup(); 58 HideAutofillPopup();
59 } 59 }
60 60
61 void AwAutofillClient::SetSaveFormData(bool enabled) { 61 void AwAutofillClient::SetSaveFormData(bool enabled) {
62 save_form_data_ = enabled; 62 save_form_data_ = enabled;
63 } 63 }
64 64
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 270
271 void AwAutofillClient::ScanCreditCard(const CreditCardScanCallback& callback) { 271 void AwAutofillClient::ScanCreditCard(const CreditCardScanCallback& callback) {
272 NOTIMPLEMENTED(); 272 NOTIMPLEMENTED();
273 } 273 }
274 274
275 bool RegisterAwAutofillClient(JNIEnv* env) { 275 bool RegisterAwAutofillClient(JNIEnv* env) {
276 return RegisterNativesImpl(env); 276 return RegisterNativesImpl(env);
277 } 277 }
278 278
279 } // namespace android_webview 279 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/native/aw_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698