| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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.content.Context; | 7 import android.content.Context; |
| 8 | 8 |
| 9 import org.chromium.base.ThreadUtils; | 9 import org.chromium.base.ThreadUtils; |
| 10 import org.chromium.base.VisibleForTesting; | 10 import org.chromium.base.VisibleForTesting; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 /** | 466 /** |
| 467 * Unregisters the provided observer. | 467 * Unregisters the provided observer. |
| 468 */ | 468 */ |
| 469 public void unregisterDataObserver(PersonalDataManagerObserver observer) { | 469 public void unregisterDataObserver(PersonalDataManagerObserver observer) { |
| 470 ThreadUtils.assertOnUiThread(); | 470 ThreadUtils.assertOnUiThread(); |
| 471 assert (mDataObservers.size() > 0); | 471 assert (mDataObservers.size() > 0); |
| 472 assert (mDataObservers.contains(observer)); | 472 assert (mDataObservers.contains(observer)); |
| 473 mDataObservers.remove(observer); | 473 mDataObservers.remove(observer); |
| 474 } | 474 } |
| 475 | 475 |
| 476 public List<AutofillProfile> getProfiles(boolean addressOnly) { | 476 public List<AutofillProfile> getProfiles() { |
| 477 ThreadUtils.assertOnUiThread(); | 477 ThreadUtils.assertOnUiThread(); |
| 478 | 478 |
| 479 String[] profileLabels = nativeGetProfileLabels(mPersonalDataManagerAndr
oid, addressOnly); | 479 String[] profileLabels = nativeGetProfileLabels(mPersonalDataManagerAndr
oid); |
| 480 | 480 |
| 481 int profileCount = nativeGetProfileCount(mPersonalDataManagerAndroid); | 481 int profileCount = nativeGetProfileCount(mPersonalDataManagerAndroid); |
| 482 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileC
ount); | 482 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileC
ount); |
| 483 for (int i = 0; i < profileCount; i++) { | 483 for (int i = 0; i < profileCount; i++) { |
| 484 AutofillProfile profile = nativeGetProfileByIndex(mPersonalDataManag
erAndroid, i); | 484 AutofillProfile profile = nativeGetProfileByIndex(mPersonalDataManag
erAndroid, i); |
| 485 profile.setLabel(profileLabels[i]); | 485 profile.setLabel(profileLabels[i]); |
| 486 profiles.add(profile); | 486 profiles.add(profile); |
| 487 } | 487 } |
| 488 | 488 |
| 489 return profiles; | 489 return profiles; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 /** | 571 /** |
| 572 * Enables or disables the Payments integration. | 572 * Enables or disables the Payments integration. |
| 573 * @param enable True to enable Payments data import. | 573 * @param enable True to enable Payments data import. |
| 574 */ | 574 */ |
| 575 public static void setPaymentsIntegrationEnabled(boolean enable) { | 575 public static void setPaymentsIntegrationEnabled(boolean enable) { |
| 576 nativeSetPaymentsIntegrationEnabled(enable); | 576 nativeSetPaymentsIntegrationEnabled(enable); |
| 577 } | 577 } |
| 578 | 578 |
| 579 private native long nativeInit(); | 579 private native long nativeInit(); |
| 580 private native int nativeGetProfileCount(long nativePersonalDataManagerAndro
id); | 580 private native int nativeGetProfileCount(long nativePersonalDataManagerAndro
id); |
| 581 private native String[] nativeGetProfileLabels(long nativePersonalDataManage
rAndroid, | 581 private native String[] nativeGetProfileLabels(long nativePersonalDataManage
rAndroid); |
| 582 boolean addressOnly); | |
| 583 private native AutofillProfile nativeGetProfileByIndex(long nativePersonalDa
taManagerAndroid, | 582 private native AutofillProfile nativeGetProfileByIndex(long nativePersonalDa
taManagerAndroid, |
| 584 int index); | 583 int index); |
| 585 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat
aManagerAndroid, | 584 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat
aManagerAndroid, |
| 586 String guid); | 585 String guid); |
| 587 private native String nativeSetProfile(long nativePersonalDataManagerAndroid
, | 586 private native String nativeSetProfile(long nativePersonalDataManagerAndroid
, |
| 588 AutofillProfile profile); | 587 AutofillProfile profile); |
| 589 private native int nativeGetCreditCardCount(long nativePersonalDataManagerAn
droid); | 588 private native int nativeGetCreditCardCount(long nativePersonalDataManagerAn
droid); |
| 590 private native CreditCard nativeGetCreditCardByIndex(long nativePersonalData
ManagerAndroid, | 589 private native CreditCard nativeGetCreditCardByIndex(long nativePersonalData
ManagerAndroid, |
| 591 int index); | 590 int index); |
| 592 private native CreditCard nativeGetCreditCardByGUID(long nativePersonalDataM
anagerAndroid, | 591 private native CreditCard nativeGetCreditCardByGUID(long nativePersonalDataM
anagerAndroid, |
| 593 String guid); | 592 String guid); |
| 594 private native String nativeSetCreditCard(long nativePersonalDataManagerAndr
oid, | 593 private native String nativeSetCreditCard(long nativePersonalDataManagerAndr
oid, |
| 595 CreditCard card); | 594 CreditCard card); |
| 596 private native void nativeRemoveByGUID(long nativePersonalDataManagerAndroid
, String guid); | 595 private native void nativeRemoveByGUID(long nativePersonalDataManagerAndroid
, String guid); |
| 597 private native void nativeClearUnmaskedCache( | 596 private native void nativeClearUnmaskedCache( |
| 598 long nativePersonalDataManagerAndroid, String guid); | 597 long nativePersonalDataManagerAndroid, String guid); |
| 599 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa
taManagerAndroid, | 598 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa
taManagerAndroid, |
| 600 WebContents webContents, String guid, FullCardRequestDelegate delega
te); | 599 WebContents webContents, String guid, FullCardRequestDelegate delega
te); |
| 601 private static native boolean nativeIsAutofillEnabled(); | 600 private static native boolean nativeIsAutofillEnabled(); |
| 602 private static native void nativeSetAutofillEnabled(boolean enable); | 601 private static native void nativeSetAutofillEnabled(boolean enable); |
| 603 private static native boolean nativeIsAutofillManaged(); | 602 private static native boolean nativeIsAutofillManaged(); |
| 604 private static native boolean nativeIsPaymentsIntegrationEnabled(); | 603 private static native boolean nativeIsPaymentsIntegrationEnabled(); |
| 605 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl
e); | 604 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl
e); |
| 606 private static native String nativeToCountryCode(String countryName); | 605 private static native String nativeToCountryCode(String countryName); |
| 607 } | 606 } |
| OLD | NEW |