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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 AutofillProfile getProfile(final String guid) throws ExecutionException { | 29 AutofillProfile getProfile(final String guid) throws ExecutionException { |
30 return ThreadUtils.runOnUiThreadBlocking(new Callable<AutofillProfile>()
{ | 30 return ThreadUtils.runOnUiThreadBlocking(new Callable<AutofillProfile>()
{ |
31 @Override | 31 @Override |
32 public AutofillProfile call() { | 32 public AutofillProfile call() { |
33 return PersonalDataManager.getInstance().getProfile(guid); | 33 return PersonalDataManager.getInstance().getProfile(guid); |
34 } | 34 } |
35 }); | 35 }); |
36 } | 36 } |
37 | 37 |
38 List<AutofillProfile> getProfilesToSuggest() throws ExecutionException { | 38 List<AutofillProfile> getProfilesToSuggest(final boolean includeName) throws |
| 39 ExecutionException { |
39 return ThreadUtils.runOnUiThreadBlocking(new Callable<List<AutofillProfi
le>>() { | 40 return ThreadUtils.runOnUiThreadBlocking(new Callable<List<AutofillProfi
le>>() { |
40 @Override | 41 @Override |
41 public List<AutofillProfile> call() { | 42 public List<AutofillProfile> call() { |
42 return PersonalDataManager.getInstance().getProfilesToSuggest(); | 43 return PersonalDataManager.getInstance().getProfilesToSuggest(in
cludeName); |
43 } | 44 } |
44 }); | 45 }); |
45 } | 46 } |
46 | 47 |
47 List<AutofillProfile> getProfilesForSettings() throws ExecutionException { | 48 List<AutofillProfile> getProfilesForSettings() throws ExecutionException { |
48 return ThreadUtils.runOnUiThreadBlocking(new Callable<List<AutofillProfi
le>>() { | 49 return ThreadUtils.runOnUiThreadBlocking(new Callable<List<AutofillProfi
le>>() { |
49 @Override | 50 @Override |
50 public List<AutofillProfile> call() { | 51 public List<AutofillProfile> call() { |
51 return PersonalDataManager.getInstance().getProfilesForSettings(
); | 52 return PersonalDataManager.getInstance().getProfilesForSettings(
); |
52 } | 53 } |
53 }); | 54 }); |
54 } | 55 } |
55 | 56 |
56 int getNumberOfProfilesToSuggest() throws ExecutionException { | 57 int getNumberOfProfilesToSuggest() throws ExecutionException { |
57 return getProfilesToSuggest().size(); | 58 return getProfilesToSuggest(false).size(); |
58 } | 59 } |
59 | 60 |
60 int getNumberOfProfilesForSettings() throws ExecutionException { | 61 int getNumberOfProfilesForSettings() throws ExecutionException { |
61 return getProfilesForSettings().size(); | 62 return getProfilesForSettings().size(); |
62 } | 63 } |
63 | 64 |
64 public String setProfile(final AutofillProfile profile) throws InterruptedEx
ception, | 65 public String setProfile(final AutofillProfile profile) throws InterruptedEx
ception, |
65 ExecutionException, TimeoutException { | 66 ExecutionException, TimeoutException { |
66 int callCount = mOnPersonalDataChangedHelper.getCallCount(); | 67 int callCount = mOnPersonalDataChangedHelper.getCallCount(); |
67 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { | 68 String guid = ThreadUtils.runOnUiThreadBlocking(new Callable<String>() { |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 @Override | 334 @Override |
334 public void onPersonalDataChanged() { | 335 public void onPersonalDataChanged() { |
335 mOnPersonalDataChangedHelper.notifyCalled(); | 336 mOnPersonalDataChangedHelper.notifyCalled(); |
336 } | 337 } |
337 } | 338 } |
338 ); | 339 ); |
339 } | 340 } |
340 }); | 341 }); |
341 } | 342 } |
342 } | 343 } |
OLD | NEW |