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

Side by Side Diff: extensions/shell/browser/shell_oauth2_token_service_delegate.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 roger's comments Created 5 years, 6 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
(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 void UpdateAuthError(const std::string& account_id,
36 const GoogleServiceAuthError& error) override;
37
38 std::vector<std::string> GetAccounts() override;
39 void RevokeAllCredentials() override;
40
41 void UpdateCredentials(const std::string& account_id,
42 const std::string& refresh_token) override;
43
44 private:
45 // Not owned.
46 content::BrowserContext* browser_context_;
47
48 // User account id, such as "foo@gmail.com".
49 std::string account_id_;
50
51 // Cached copy of an OAuth2 refresh token. Not stored on disk.
52 std::string refresh_token_;
53
54 DISALLOW_COPY_AND_ASSIGN(ShellOAuth2TokenServiceDelegate);
55 };
56
57 } // namespace extensions
58 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698