1 // Copyright 2015 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.
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_
10 #include "content/public/browser/browser_context.h"
11 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h"
12 #include "google_apis/gaia/oauth2_token_service_delegate.h"
18 namespace extensions
{
20 class ShellOAuth2TokenServiceDelegate
: public OAuth2TokenServiceDelegate
{
22 ShellOAuth2TokenServiceDelegate(content::BrowserContext
* browser_context
,
23 std::string account_id
,
24 std::string refresh_token
);
25 ~ShellOAuth2TokenServiceDelegate() override
;
27 bool RefreshTokenIsAvailable(const std::string
& account_id
) const override
;
29 OAuth2AccessTokenFetcher
* CreateAccessTokenFetcher(
30 const std::string
& account_id
,
31 net::URLRequestContextGetter
* getter
,
32 OAuth2AccessTokenConsumer
* consumer
) override
;
33 net::URLRequestContextGetter
* GetRequestContext() const override
;
35 std::vector
<std::string
> GetAccounts() override
;
37 void UpdateCredentials(const std::string
& account_id
,
38 const std::string
& refresh_token
) override
;
42 content::BrowserContext
* browser_context_
;
44 // User account id, such as "foo@gmail.com".
45 std::string account_id_
;
47 // Cached copy of an OAuth2 refresh token. Not stored on disk.
48 std::string refresh_token_
;
50 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenServiceDelegate
);
53 } // namespace extensions