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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java

Issue 12942004: Add Glue as delegate to AutofillDialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Imports cleanup Created 7 years, 9 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 | Annotate | Revision Log
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 package org.chromium.chrome.browser.autofill; 5 package org.chromium.chrome.browser.autofill;
6 6
7 import android.graphics.Bitmap; 7 import android.graphics.Bitmap;
8 8
9 import org.chromium.base.CalledByNative; 9 import org.chromium.base.CalledByNative;
10 import org.chromium.base.JNINamespace; 10 import org.chromium.base.JNINamespace;
11 import org.chromium.chrome.browser.autofill.AutofillDialog.AutofillDialogDelegat e; 11 import org.chromium.chrome.browser.autofill.AutofillDialog.AutofillDialogDelegat e;
12 import org.chromium.ui.gfx.NativeWindow; 12 import org.chromium.ui.gfx.NativeWindow;
13 13
14 /** 14 /**
15 * JNI call glue for AutofillDialog C++ and Java objects. 15 * JNI call glue for AutofillDialog C++ and Java objects.
16 */ 16 */
17 @JNINamespace("autofill") 17 @JNINamespace("autofill")
18 public class AutofillDialogGlue implements AutofillDialogDelegate { 18 public class AutofillDialogGlue implements AutofillDialogDelegate {
19 @SuppressWarnings("unused") 19 @SuppressWarnings("unused")
20 private final int mNativeDialogPopup; 20 private final int mNativeDialogPopup;
21 private AutofillDialog mAutofillDialog; 21 private AutofillDialog mAutofillDialog;
22 22
23 public AutofillDialogGlue(int nativeAutofillDialogViewAndroid, NativeWindow nativeWindow) { 23 public AutofillDialogGlue(int nativeAutofillDialogViewAndroid, NativeWindow nativeWindow) {
24 mNativeDialogPopup = nativeAutofillDialogViewAndroid; 24 mNativeDialogPopup = nativeAutofillDialogViewAndroid;
25 25
26 mAutofillDialog = new AutofillDialog(nativeWindow.getContext()); 26 mAutofillDialog = new AutofillDialog(nativeWindow.getContext(), this);
27 mAutofillDialog.show(); 27 mAutofillDialog.show();
28 } 28 }
29 29
30 @CalledByNative 30 @CalledByNative
31 private static AutofillDialogGlue create(int nativeAutofillDialogViewAndroid , 31 private static AutofillDialogGlue create(int nativeAutofillDialogViewAndroid ,
32 NativeWindow nativeWindow) { 32 NativeWindow nativeWindow) {
33 return new AutofillDialogGlue(nativeAutofillDialogViewAndroid, nativeWin dow); 33 return new AutofillDialogGlue(nativeAutofillDialogViewAndroid, nativeWin dow);
34 } 34 }
35 35
36 /** 36 /**
37 * Updates a section of Autofill dialog. 37 * Updates a section of Autofill dialog.
38 * @param section Section that needs to be updated. Should match one of the values in 38 * @param section Section that needs to be updated. Should match one of the values in
39 * {@link AutofillDialogConstants}. 39 * {@link AutofillDialogConstants}.
40 * @param dialogInputs The array of values for inputs in the dialog. 40 * @param dialogInputs The array of values for inputs in the dialog.
41 */ 41 */
42 @CalledByNative 42 @CalledByNative
43 private void updateSection(int section, boolean visible, AutofillDialogField [] dialogInputs, 43 private void updateSection(int section, boolean visible, AutofillDialogField [] dialogInputs,
44 AutofillDialogMenuItem[] menuItems) { 44 AutofillDialogMenuItem[] menuItems) {
45 mAutofillDialog.updateSection(section, visible, dialogInputs, menuItems) ; 45 mAutofillDialog.updateSection(section, visible, dialogInputs, menuItems) ;
46 } 46 }
47 47
48 /**
49 * Notifies the dialog that the underlying model is changed and all section s will be updated.
50 * @param fetchingIsActive If true, the data is being fetched and is not ye t available.
51 */
52 private void modelChanged(boolean fetchingIsActive) {
Ted C 2013/03/20 19:04:31 indenting is off on these two methods
Yusuf 2013/03/21 00:53:17 Done.
53 mAutofillDialog.modelChanged(fetchingIsActive);
54 }
55
56 /**
57 * Updates the account chooser of Autofill dialog.
58 * @param accountNames List of accounts to be shown.
59 * @param selectedAccountIndex Index of the currently selected account.
60 */
61 private void updateAccountChooser(String[] accountNames, int selectedAccoun tIndex) {
62 mAutofillDialog.updateAccountChooserAndAddTitle(accountNames, selectedA ccountIndex);
63 }
64
48 @CalledByNative 65 @CalledByNative
49 private AutofillDialogField[] getSection(int section) { 66 private AutofillDialogField[] getSection(int section) {
50 return mAutofillDialog.getSection(section); 67 return mAutofillDialog.getSection(section);
51 } 68 }
52 69
53 @CalledByNative 70 @CalledByNative
54 private String getCvc() { 71 private String getCvc() {
55 return mAutofillDialog.getCvc(); 72 return mAutofillDialog.getCvc();
56 } 73 }
57 74
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 179
163 private native void nativeItemSelected(int nativeAutofillDialogViewAndroid, int section, 180 private native void nativeItemSelected(int nativeAutofillDialogViewAndroid, int section,
164 int index); 181 int index);
165 private native void nativeAccountSelected(int nativeAutofillDialogViewAndroi d, int index); 182 private native void nativeAccountSelected(int nativeAutofillDialogViewAndroi d, int index);
166 private native void nativeEditingStart(int nativeAutofillDialogViewAndroid, int section); 183 private native void nativeEditingStart(int nativeAutofillDialogViewAndroid, int section);
167 private native void nativeEditingComplete(int nativeAutofillDialogViewAndroi d, int section); 184 private native void nativeEditingComplete(int nativeAutofillDialogViewAndroi d, int section);
168 private native void nativeEditingCancel(int nativeAutofillDialogViewAndroid, int section); 185 private native void nativeEditingCancel(int nativeAutofillDialogViewAndroid, int section);
169 private native void nativeDialogSubmit(int nativeAutofillDialogViewAndroid); 186 private native void nativeDialogSubmit(int nativeAutofillDialogViewAndroid);
170 private native void nativeDialogCancel(int nativeAutofillDialogViewAndroid); 187 private native void nativeDialogCancel(int nativeAutofillDialogViewAndroid);
171 } 188 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698