Refactor AO2TS to make it easier to componentize
[chromium-blink-merge.git] / extensions / shell / browser / shell_oauth2_token_service.h
blobc93c9f209924cda9a8057b8aa0221442f323ae56
1 // Copyright 2014 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_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_
8 #include <string>
10 #include "base/macros.h"
11 #include "google_apis/gaia/oauth2_token_service.h"
13 namespace content {
14 class BrowserContext;
17 namespace extensions {
19 // Requests OAuth2 access tokens for app_shell. Requires the OAuth2 refresh
20 // token to be set explicitly. Only stores a single refresh token for a single
21 // user account. Created and accessed on the UI thread. Only one instance is
22 // allowed.
23 class ShellOAuth2TokenService : public OAuth2TokenService {
24 public:
25 ShellOAuth2TokenService(content::BrowserContext* browser_context,
26 std::string account_id,
27 std::string refresh_token);
28 ~ShellOAuth2TokenService() override;
30 // Returns the single instance for app_shell.
31 static ShellOAuth2TokenService* GetInstance();
33 void SetRefreshToken(const std::string& account_id,
34 const std::string& refresh_token);
36 std::string AccountId() const;
38 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenService);
41 } // namespace extensions
43 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_