OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_DELEGATE_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 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" |
| 13 |
| 14 namespace content { |
| 15 class BrowserContext; |
| 16 } |
| 17 |
| 18 namespace extensions { |
| 19 |
| 20 class ShellOAuth2TokenServiceDelegate : public OAuth2TokenServiceDelegate { |
| 21 public: |
| 22 ShellOAuth2TokenServiceDelegate(content::BrowserContext* browser_context, |
| 23 std::string account_id, |
| 24 std::string refresh_token); |
| 25 ~ShellOAuth2TokenServiceDelegate() override; |
| 26 |
| 27 bool RefreshTokenIsAvailable(const std::string& account_id) const override; |
| 28 |
| 29 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher( |
| 30 const std::string& account_id, |
| 31 net::URLRequestContextGetter* getter, |
| 32 OAuth2AccessTokenConsumer* consumer) override; |
| 33 net::URLRequestContextGetter* GetRequestContext() const override; |
| 34 |
| 35 std::vector<std::string> GetAccounts() override; |
| 36 |
| 37 void UpdateCredentials(const std::string& account_id, |
| 38 const std::string& refresh_token) override; |
| 39 |
| 40 private: |
| 41 // Not owned. |
| 42 content::BrowserContext* browser_context_; |
| 43 |
| 44 // User account id, such as "foo@gmail.com". |
| 45 std::string account_id_; |
| 46 |
| 47 // Cached copy of an OAuth2 refresh token. Not stored on disk. |
| 48 std::string refresh_token_; |
| 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenServiceDelegate); |
| 51 }; |
| 52 |
| 53 } // namespace extensions |
| 54 #endif |
OLD | NEW |