| 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.
|
| +// 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() {
|
| + List<String> countries = new ArrayList<String>();
|
| + nativeGetAvailableCountries(countries);
|
| + return countries;
|
| + }
|
| +
|
| + public static List<Pair<String, String>> getAddressUiComponents(String countryCode,
|
| + 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);
|
| +}
|
|
|