- add sources.
[platform/framework/web/crosswalk.git] / src / sync / android / java / src / org / chromium / sync / signin / AccountManagerDelegate.java
1 // Copyright (c) 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.AccountManagerCallback;
9 import android.accounts.AccountManagerFuture;
10 import android.accounts.AuthenticatorDescription;
11 import android.accounts.AuthenticatorException;
12 import android.accounts.OperationCanceledException;
13 import android.app.Activity;
14 import android.os.Bundle;
15 import android.os.Handler;
16
17 import java.io.IOException;
18
19 /**
20  * Wrapper around the Android account manager, to facilitate dependency injection during testing.
21  */
22 public interface AccountManagerDelegate {
23     Account[] getAccountsByType(String type);
24
25     AccountManagerFuture<Bundle> getAuthToken(Account account, String authTokenType,
26             boolean notifyAuthFailure, AccountManagerCallback<Bundle> callback, Handler handler);
27
28     AccountManagerFuture<Bundle> getAuthToken(Account account, String authTokenType, Bundle options,
29             Activity activity, AccountManagerCallback<Bundle> callback, Handler handler);
30
31     void invalidateAuthToken(String accountType, String authToken);
32
33     String blockingGetAuthToken(Account account, String authTokenType, boolean notifyAuthFailure)
34             throws OperationCanceledException, IOException, AuthenticatorException;
35
36     Account[] getAccounts();
37
38     boolean addAccountExplicitly(Account account, String password, Bundle userdata);
39
40     AccountManagerFuture<Boolean> removeAccount(Account account,
41             AccountManagerCallback<Boolean> callback, Handler handler);
42
43     String getPassword(Account account);
44
45     void setPassword(Account account, String password);
46
47     void clearPassword(Account account);
48
49     AccountManagerFuture<Bundle> confirmCredentials(Account account, Bundle bundle,
50             Activity activity, AccountManagerCallback<Bundle> callback, Handler handler);
51
52     String peekAuthToken(Account account, String authTokenType);
53
54     AuthenticatorDescription[] getAuthenticatorTypes();
55 }