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

Side by Side Diff: chrome/browser/net/gaia/gaia_oauth_fetcher.h

Issue 8248002: Merge 103908 - Extend GaiaOAuthFetcher with support for revoking tokens. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/874/src/
Patch Set: Created 9 years, 2 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_NET_GAIA_GAIA_OAUTH_FETCHER_H_ 5 #ifndef CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_
6 #define CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ 6 #define CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 const std::string& oauth1_access_token, 99 const std::string& oauth1_access_token,
100 const std::string& oauth1_access_token_secret, 100 const std::string& oauth1_access_token_secret,
101 const std::string& wrap_token_duration, 101 const std::string& wrap_token_duration,
102 const std::string& service_scope); 102 const std::string& service_scope);
103 103
104 // Obtains user information related to an OAuth2 access token 104 // Obtains user information related to an OAuth2 access token
105 // 105 //
106 // oauth2_access_token is from OAuthWrapBridge's result. 106 // oauth2_access_token is from OAuthWrapBridge's result.
107 virtual void StartUserInfo(const std::string& oauth2_access_token); 107 virtual void StartUserInfo(const std::string& oauth2_access_token);
108 108
109 // Starts a request for revoking the given OAuth access token (as requested by
110 // StartOAuthGetAccessToken).
111 virtual void StartOAuthRevokeAccessToken(const std::string& token,
112 const std::string& secret);
113
114 // Starts a request for revoking the given OAuth Bearer token (as requested by
115 // StartOAuthWrapBridge).
116 virtual void StartOAuthRevokeWrapToken(const std::string& token);
117
109 // NotificationObserver implementation. 118 // NotificationObserver implementation.
110 virtual void Observe(int type, 119 virtual void Observe(int type,
111 const NotificationSource& source, 120 const NotificationSource& source,
112 const NotificationDetails& details) OVERRIDE; 121 const NotificationDetails& details) OVERRIDE;
113 122
114 // Called when a cookie, e. g. oauth_token, changes 123 // Called when a cookie, e. g. oauth_token, changes
115 virtual void OnCookieChanged(Profile* profile, 124 virtual void OnCookieChanged(Profile* profile,
116 ChromeCookieDetails* cookie_details); 125 ChromeCookieDetails* cookie_details);
117 126
118 // Called when a cookie, e. g. oauth_token, changes 127 // Called when a cookie, e. g. oauth_token, changes
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Process the results of a OAuthGetAccessToken fetch. 160 // Process the results of a OAuthGetAccessToken fetch.
152 virtual void OnOAuthGetAccessTokenFetched(const std::string& data, 161 virtual void OnOAuthGetAccessTokenFetched(const std::string& data,
153 const net::URLRequestStatus& status, 162 const net::URLRequestStatus& status,
154 int response_code); 163 int response_code);
155 164
156 // Process the results of a OAuthWrapBridge fetch. 165 // Process the results of a OAuthWrapBridge fetch.
157 virtual void OnOAuthWrapBridgeFetched(const std::string& data, 166 virtual void OnOAuthWrapBridgeFetched(const std::string& data,
158 const net::URLRequestStatus& status, 167 const net::URLRequestStatus& status,
159 int response_code); 168 int response_code);
160 169
170 // Process the results of a token revocation fetch.
171 virtual void OnOAuthRevokeTokenFetched(const std::string& data,
172 const net::URLRequestStatus& status,
173 int response_code);
174
161 // Process the results of a userinfo fetch. 175 // Process the results of a userinfo fetch.
162 virtual void OnUserInfoFetched(const std::string& data, 176 virtual void OnUserInfoFetched(const std::string& data,
163 const net::URLRequestStatus& status, 177 const net::URLRequestStatus& status,
164 int response_code); 178 int response_code);
165 179
166 // Tokenize the results of a GetOAuthToken fetch. 180 // Tokenize the results of a GetOAuthToken fetch.
167 static void ParseGetOAuthTokenResponse(const std::string& data, 181 static void ParseGetOAuthTokenResponse(const std::string& data,
168 std::string* token); 182 std::string* token);
169 183
170 // Tokenize the results of a OAuthLogin fetch. 184 // Tokenize the results of a OAuthLogin fetch.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 const std::string& oauth1_access_token, 221 const std::string& oauth1_access_token,
208 const std::string& oauth1_access_token_secret); 222 const std::string& oauth1_access_token_secret);
209 223
210 // Given parameters, create a OAuthWrapBridge request body. 224 // Given parameters, create a OAuthWrapBridge request body.
211 static std::string MakeOAuthWrapBridgeBody( 225 static std::string MakeOAuthWrapBridgeBody(
212 const std::string& oauth1_access_token, 226 const std::string& oauth1_access_token,
213 const std::string& oauth1_access_token_secret, 227 const std::string& oauth1_access_token_secret,
214 const std::string& wrap_token_duration, 228 const std::string& wrap_token_duration,
215 const std::string& oauth2_service_scope); 229 const std::string& oauth2_service_scope);
216 230
217 // Given parameters, create a userinfo request body.
218 static std::string MakeUserInfoBody(const std::string& oauth2_access_token);
219
220 // Create a fetcher useable for making any Gaia OAuth request. 231 // Create a fetcher useable for making any Gaia OAuth request.
221 static URLFetcher* CreateGaiaFetcher(net::URLRequestContextGetter* getter, 232 static URLFetcher* CreateGaiaFetcher(net::URLRequestContextGetter* getter,
222 const GURL& gaia_gurl_, 233 const GURL& gaia_gurl_,
223 const std::string& body, 234 const std::string& body,
224 const std::string& headers, 235 const std::string& headers,
225 bool send_cookies, 236 bool send_cookies,
226 URLFetcher::Delegate* delegate); 237 URLFetcher::Delegate* delegate);
227 238
228 bool ShouldAutoFetch(AutoFetchLimit fetch_step); 239 bool ShouldAutoFetch(AutoFetchLimit fetch_step);
229 240
230 // These fields are common to GaiaOAuthFetcher, same every request 241 // These fields are common to GaiaOAuthFetcher, same every request
231 GaiaOAuthConsumer* const consumer_; 242 GaiaOAuthConsumer* const consumer_;
232 net::URLRequestContextGetter* const getter_; 243 net::URLRequestContextGetter* const getter_;
233 Profile* profile_; 244 Profile* profile_;
234 Browser* popup_; 245 Browser* popup_;
235 NotificationRegistrar registrar_; 246 NotificationRegistrar registrar_;
236 247
237 // While a fetch is going on: 248 // While a fetch is going on:
238 scoped_ptr<URLFetcher> fetcher_; 249 scoped_ptr<URLFetcher> fetcher_;
239 std::string request_body_; 250 std::string request_body_;
240 std::string request_headers_; 251 std::string request_headers_;
241 std::string service_scope_; 252 std::string service_scope_;
242 bool fetch_pending_; 253 bool fetch_pending_;
243 AutoFetchLimit auto_fetch_limit_; 254 AutoFetchLimit auto_fetch_limit_;
244 255
245 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher); 256 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher);
246 }; 257 };
247 258
248 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ 259 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/gaia/gaia_oauth_consumer.h ('k') | chrome/browser/net/gaia/gaia_oauth_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698