17dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved.
27dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
37dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch// found in the LICENSE file.
47dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
57dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochpackage org.chromium.chrome.browser.signin;
67dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
77dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport android.accounts.Account;
87dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport android.app.Activity;
97dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport android.content.Context;
107dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
117dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport org.chromium.sync.signin.AccountManagerHelper;
127dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
137dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport java.util.concurrent.TimeUnit;
14a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)
157dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdochimport javax.annotation.Nullable;
167dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
177dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch/**
184e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) * Temporary wrapper class until all callers have moved to use {@link OAuth2TokenService}.
194e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) * TODO(nyquist) Remove this class.
207dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch */
21a36e5920737c6adbddd3e43b760e5de8431db6e0Torne (Richard Coles)public final class AndroidProfileOAuth2TokenServiceHelper {
227dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
234e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    private AndroidProfileOAuth2TokenServiceHelper() {}
247dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
257dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    /**
264e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)     * Use {@link OAuth2TokenService#getOAuth2AccessToken} instead.
277dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch     */
284e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    @Deprecated
297dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    public static void getOAuth2AccessToken(Context context, @Nullable Activity activity,
304e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)            Account account, String scope, AccountManagerHelper.GetAuthTokenCallback callback) {
314e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)        OAuth2TokenService.getOAuth2AccessToken(context, activity, account, scope, callback);
327dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    }
337dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
347dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    /**
354e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)     * Use {@link OAuth2TokenService#invalidateOAuth2AuthToken} instead.
367dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch     */
374e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    @Deprecated
384e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    public static void invalidateOAuth2AuthToken(Context context, String accessToken) {
394e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)        OAuth2TokenService.invalidateOAuth2AuthToken(context, accessToken);
407dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    }
417dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch
427dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    /**
434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)     * Use {@link OAuth2TokenService#getOAuth2AccessTokenWithTimeout} instead.
4468043e1e95eeb07d5cae7aca370b26518b0867d6Torne (Richard Coles)     */
454e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    @Deprecated
464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    public static String getOAuth2AccessTokenWithTimeout(Context context,
474e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)            @Nullable Activity activity, Account account, String scope,
484e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)            long timeout, TimeUnit unit) {
494e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)        return OAuth2TokenService.getOAuth2AccessTokenWithTimeout(
504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)                context, activity, account, scope, timeout, unit);
517dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch    }
527dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch}
53