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

Side by Side Diff: chrome/browser/signin/oauth2_token_service.h

Issue 12538009: Public Sessions: fetch device robot api token during enterprise enrollment. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: make api auth fetching optional; add auth failure test cases Created 7 years, 8 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ 5 #ifndef CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_
6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ 6 #define CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // Mark an OAuth2 access token as invalid. This should be done if the token 94 // Mark an OAuth2 access token as invalid. This should be done if the token
95 // was received from this class, but was not accepted by the server (e.g., 95 // was received from this class, but was not accepted by the server (e.g.,
96 // the server returned 401 Unauthorized). The token will be removed from the 96 // the server returned 401 Unauthorized). The token will be removed from the
97 // cache for the given scopes. 97 // cache for the given scopes.
98 virtual void InvalidateToken(const ScopeSet& scopes, 98 virtual void InvalidateToken(const ScopeSet& scopes,
99 const std::string& invalid_token); 99 const std::string& invalid_token);
100 100
101 // Return the current number of entries in the cache. 101 // Return the current number of entries in the cache.
102 int cache_size_for_testing() const; 102 int cache_size_for_testing() const;
103 103
104 protected:
105 // Subclasses should return the refresh token maintained. 104 // Subclasses should return the refresh token maintained.
106 // If no token is available, return an empty string. 105 // If no token is available, return an empty string.
107 virtual std::string GetRefreshToken() = 0; 106 virtual std::string GetRefreshToken() = 0;
108 107
108 protected:
109 // Subclasses can override if they want to report errors to the user. 109 // Subclasses can override if they want to report errors to the user.
110 virtual void UpdateAuthError(const GoogleServiceAuthError& error); 110 virtual void UpdateAuthError(const GoogleServiceAuthError& error);
111 111
112 // Add a new entry to the cache. 112 // Add a new entry to the cache.
113 // Subclasses can override if there are implementation-specific reasons 113 // Subclasses can override if there are implementation-specific reasons
114 // that an access token should ever not be cached. 114 // that an access token should ever not be cached.
115 virtual void RegisterCacheEntry(const std::string& refresh_token, 115 virtual void RegisterCacheEntry(const std::string& refresh_token,
116 const ScopeSet& scopes, 116 const ScopeSet& scopes,
117 const std::string& access_token, 117 const std::string& access_token,
118 const base::Time& expiration_date); 118 const base::Time& expiration_date);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // token. 193 // token.
194 typedef std::pair<std::string, ScopeSet> FetchParameters; 194 typedef std::pair<std::string, ScopeSet> FetchParameters;
195 // A map from fetch parameters to a fetcher that is fetching an OAuth2 access 195 // A map from fetch parameters to a fetcher that is fetching an OAuth2 access
196 // token using these parameters. 196 // token using these parameters.
197 std::map<FetchParameters, Fetcher*> pending_fetchers_; 197 std::map<FetchParameters, Fetcher*> pending_fetchers_;
198 198
199 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService); 199 DISALLOW_COPY_AND_ASSIGN(OAuth2TokenService);
200 }; 200 };
201 201
202 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_ 202 #endif // CHROME_BROWSER_SIGNIN_OAUTH2_TOKEN_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698