Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0e590f25bf35b10663ec3d58d0216bbef7140b6c |
| --- /dev/null |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/autofill/AutofillProfileBridge.java |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
|
newt (away)
2015/01/27 01:45:05
2015, here and elsewhere
Theresa
2015/01/28 02:05:40
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.chrome.browser.preferences.autofill; |
| + |
| +import android.util.Pair; |
| + |
| +import org.chromium.base.CalledByNative; |
| +import org.chromium.base.JNINamespace; |
| + |
| +import java.util.ArrayList; |
| +import java.util.List; |
| + |
| +/** |
| + * Static methods to fetch information needed to create the address fields for the autofill profile |
| + * form. |
| + */ |
| +@JNINamespace("autofill::android") |
| +public class AutofillProfileBridge { |
| + public static List<String> getAvailableCountries() { |
|
newt (away)
2015/01/27 01:45:05
javadoc for all public methods
Theresa
2015/01/28 02:05:40
Done.
|
| + List<String> countries = new ArrayList<String>(); |
| + nativeGetAvailableCountries(countries); |
| + return countries; |
| + } |
| + |
| + public static List<Pair<String, String>> getAddressUiComponents(String countryCode, |
|
newt (away)
2015/01/27 01:45:05
javadoc. *especially* for a method that returns a
Theresa
2015/01/28 02:05:40
Done.
|
| + String uiLanguageTag) { |
| + List<String> componentIds = new ArrayList<String>(); |
| + List<String> componentNames = new ArrayList<String>(); |
| + List<Pair<String, String>> uiComponents = new ArrayList<Pair<String, String>>(); |
| + nativeGetAddressUiComponents(countryCode, uiLanguageTag, componentIds, componentNames); |
| + for (int i = 0; i < componentIds.size(); i++) { |
| + uiComponents.add(new Pair<String, String>(componentIds.get(i), componentNames.get(i))); |
| + } |
| + return uiComponents; |
| + } |
| + |
| + @CalledByNative |
| + private static void stringArrayToList(String[] array, List<String> list) { |
| + for (String s : array) { |
| + list.add(s); |
| + } |
| + } |
| + |
| + private static native void nativeGetAvailableCountries(List<String> countries); |
| + private static native void nativeGetAddressUiComponents(String countryCode, |
| + String uiLanguageTag, List<String> componentIds, List<String> componentNames); |
| +} |