| 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 org.chromium.base.ThreadUtils; | 7 import org.chromium.base.ThreadUtils; |
| 8 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 8 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
| 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; | 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.CreditCard; |
| 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana
gerObserver; | 10 import org.chromium.chrome.browser.autofill.PersonalDataManager.PersonalDataMana
gerObserver; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 int getNumberOfProfiles() throws ExecutionException { | 46 int getNumberOfProfiles() throws ExecutionException { |
| 47 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { | 47 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { |
| 48 @Override | 48 @Override |
| 49 public Integer call() { | 49 public Integer call() { |
| 50 return PersonalDataManager.getInstance().getProfiles().size(); | 50 return PersonalDataManager.getInstance().getProfiles().size(); |
| 51 } | 51 } |
| 52 }).intValue(); | 52 }).intValue(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 public String setProfile(final AutofillProfile profile) throws InterruptedEx
ception, | 55 String setProfile(final AutofillProfile profile) throws InterruptedException
, |
| 56 ExecutionException { | 56 ExecutionException { |
| 57 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { | 57 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| 58 @Override | 58 @Override |
| 59 public String call() { | 59 public String call() { |
| 60 return PersonalDataManager.getInstance().setProfile(profile); | 60 return PersonalDataManager.getInstance().setProfile(profile); |
| 61 } | 61 } |
| 62 }); | 62 }); |
| 63 waitForDataChanged(); | 63 waitForDataChanged(); |
| 64 return guid; | 64 return guid; |
| 65 } | 65 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 85 | 85 |
| 86 int getNumberOfCreditCards() throws ExecutionException { | 86 int getNumberOfCreditCards() throws ExecutionException { |
| 87 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { | 87 return ThreadUtils.runOnUiThreadBlocking(new Callable<Integer>() { |
| 88 @Override | 88 @Override |
| 89 public Integer call() { | 89 public Integer call() { |
| 90 return PersonalDataManager.getInstance().getCreditCards().size()
; | 90 return PersonalDataManager.getInstance().getCreditCards().size()
; |
| 91 } | 91 } |
| 92 }).intValue(); | 92 }).intValue(); |
| 93 } | 93 } |
| 94 | 94 |
| 95 public String setCreditCard(final CreditCard card) throws InterruptedExcepti
on, | 95 String setCreditCard(final CreditCard card) throws InterruptedException, Exe
cutionException { |
| 96 ExecutionException { | |
| 97 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { | 96 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
| 98 @Override | 97 @Override |
| 99 public String call() { | 98 public String call() { |
| 100 return PersonalDataManager.getInstance().setCreditCard(card); | 99 return PersonalDataManager.getInstance().setCreditCard(card); |
| 101 } | 100 } |
| 102 }); | 101 }); |
| 103 waitForDataChanged(); | 102 waitForDataChanged(); |
| 104 return guid; | 103 return guid; |
| 105 } | 104 } |
| 106 | 105 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 132 }); | 131 }); |
| 133 } | 132 } |
| 134 | 133 |
| 135 @SuppressWarnings("WaitNotInLoop") | 134 @SuppressWarnings("WaitNotInLoop") |
| 136 public void waitForDataChanged() throws InterruptedException { | 135 public void waitForDataChanged() throws InterruptedException { |
| 137 synchronized (mObserverNotified) { | 136 synchronized (mObserverNotified) { |
| 138 mObserverNotified.wait(3000); | 137 mObserverNotified.wait(3000); |
| 139 } | 138 } |
| 140 } | 139 } |
| 141 } | 140 } |
| OLD | NEW |