Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service.h

Issue 1143323005: Refactor AO2TS to make it easier to componentize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address final comments Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_ 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 class ShellOAuth2TokenService : public OAuth2TokenService { 23 class ShellOAuth2TokenService : public OAuth2TokenService {
24 public: 24 public:
25 ShellOAuth2TokenService(content::BrowserContext* browser_context, 25 ShellOAuth2TokenService(content::BrowserContext* browser_context,
26 std::string account_id, 26 std::string account_id,
27 std::string refresh_token); 27 std::string refresh_token);
28 ~ShellOAuth2TokenService() override; 28 ~ShellOAuth2TokenService() override;
29 29
30 // Returns the single instance for app_shell. 30 // Returns the single instance for app_shell.
31 static ShellOAuth2TokenService* GetInstance(); 31 static ShellOAuth2TokenService* GetInstance();
32 32
33 std::string account_id() const { return account_id_; }
34
35 // Sets the current user account and refresh token.
36 void SetRefreshToken(const std::string& account_id, 33 void SetRefreshToken(const std::string& account_id,
37 const std::string& refresh_token); 34 const std::string& refresh_token);
38 35
39 // OAuth2TokenService: 36 std::string AccountId() const;
40 bool RefreshTokenIsAvailable(const std::string& account_id) const override;
41 OAuth2AccessTokenFetcher* CreateAccessTokenFetcher(
42 const std::string& account_id,
43 net::URLRequestContextGetter* getter,
44 OAuth2AccessTokenConsumer* consumer) override;
45 net::URLRequestContextGetter* GetRequestContext() override;
46
47 private:
48 // Not owned.
49 content::BrowserContext* browser_context_;
50
51 // User account id, such as "foo@gmail.com".
52 std::string account_id_;
53
54 // Cached copy of an OAuth2 refresh token. Not stored on disk.
55 std::string refresh_token_;
56 37
57 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenService); 38 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenService);
58 }; 39 };
59 40
60 } // namespace extensions 41 } // namespace extensions
61 42
62 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_ 43 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_OAUTH2_TOKEN_SERVICE_H_
OLDNEW
« no previous file with comments | « extensions/shell/browser/api/identity/identity_api.cc ('k') | extensions/shell/browser/shell_oauth2_token_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698