OLD | NEW |
| (Empty) |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 package org.chromium.sync.signin; | |
6 | |
7 import android.accounts.Account; | |
8 import android.accounts.AuthenticatorDescription; | |
9 | |
10 import org.chromium.base.Callback; | |
11 | |
12 /** | |
13 * Wrapper around the Android account manager, to facilitate dependency injectio
n during testing. | |
14 */ | |
15 public interface AccountManagerDelegate { | |
16 /** | |
17 * This method is deprecated; please use the asynchronous version below inst
ead. | |
18 * | |
19 * See http://crbug.com/517697 for details. | |
20 */ | |
21 Account[] getAccountsByType(String type); | |
22 | |
23 /** | |
24 * Get all the accounts for a given {@code type}. | |
25 */ | |
26 void getAccountsByType(String type, Callback<Account[]> callback); | |
27 | |
28 /** | |
29 * Get an auth token. This should only be called on a background thread. | |
30 * | |
31 * @param account The {@link Account} for which the auth token is requested. | |
32 * @param authTokenScope The scope of the authToken being requested. | |
33 * @return The auth token fetched from the authenticator. | |
34 * @throws AuthException Indicates a failure in fetching the auth token perh
aps due to a | |
35 * transient error or when user intervention is required (like confirming th
e credentials) | |
36 * which is expressed as an {@link Intent} to the handler. | |
37 */ | |
38 String getAuthToken(Account account, String authTokenScope) throws AuthExcep
tion; | |
39 | |
40 /** | |
41 * @param authToken The auth token to invalidate. | |
42 * @throws AuthException Indicates a failure clearing the auth token; can be
transient. | |
43 */ | |
44 void invalidateAuthToken(String authToken) throws AuthException; | |
45 | |
46 /** | |
47 * Get all the available authenticator types. | |
48 */ | |
49 AuthenticatorDescription[] getAuthenticatorTypes(); | |
50 | |
51 /** | |
52 * Check whether the {@code account} has all the features listed in {@code f
eatures}. | |
53 */ | |
54 void hasFeatures(Account account, String[] features, Callback<Boolean> callb
ack); | |
55 } | |
OLD | NEW |