| OLD | NEW |
| 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 #include <vector> | 10 #include <vector> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 // Called when a cookie, e. g. oauth_token, changes | 130 // Called when a cookie, e. g. oauth_token, changes |
| 131 virtual void OnCookieChanged(Profile* profile, | 131 virtual void OnCookieChanged(Profile* profile, |
| 132 ChromeCookieDetails* cookie_details); | 132 ChromeCookieDetails* cookie_details); |
| 133 | 133 |
| 134 // Called when a cookie, e. g. oauth_token, changes | 134 // Called when a cookie, e. g. oauth_token, changes |
| 135 virtual void OnBrowserClosing(Browser* profile, | 135 virtual void OnBrowserClosing(Browser* profile, |
| 136 bool detail); | 136 bool detail); |
| 137 | 137 |
| 138 // Implementation of content::URLFetcherDelegate | 138 // Implementation of content::URLFetcherDelegate |
| 139 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 139 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
| 140 | 140 |
| 141 // StartGetOAuthToken (or other Start* routine) been called, but results | 141 // StartGetOAuthToken (or other Start* routine) been called, but results |
| 142 // are not back yet. | 142 // are not back yet. |
| 143 virtual bool HasPendingFetch(); | 143 virtual bool HasPendingFetch(); |
| 144 | 144 |
| 145 // Stop any URL fetches in progress. | 145 // Stop any URL fetches in progress. |
| 146 virtual void CancelRequest(); | 146 virtual void CancelRequest(); |
| 147 | 147 |
| 148 private: | 148 private: |
| 149 // Process the results of a GetOAuthToken fetch via UI. | 149 // Process the results of a GetOAuthToken fetch via UI. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 const std::string& oauth1_access_token_secret); | 224 const std::string& oauth1_access_token_secret); |
| 225 | 225 |
| 226 // Given parameters, create a OAuthWrapBridge request body. | 226 // Given parameters, create a OAuthWrapBridge request body. |
| 227 static std::string MakeOAuthWrapBridgeBody( | 227 static std::string MakeOAuthWrapBridgeBody( |
| 228 const std::string& oauth1_access_token, | 228 const std::string& oauth1_access_token, |
| 229 const std::string& oauth1_access_token_secret, | 229 const std::string& oauth1_access_token_secret, |
| 230 const std::string& wrap_token_duration, | 230 const std::string& wrap_token_duration, |
| 231 const std::string& oauth2_service_scope); | 231 const std::string& oauth2_service_scope); |
| 232 | 232 |
| 233 // Create a fetcher useable for making any Gaia OAuth request. | 233 // Create a fetcher useable for making any Gaia OAuth request. |
| 234 static URLFetcher* CreateGaiaFetcher(net::URLRequestContextGetter* getter, | 234 static content::URLFetcher* CreateGaiaFetcher( |
| 235 const GURL& gaia_gurl_, | 235 net::URLRequestContextGetter* getter, |
| 236 const std::string& body, | 236 const GURL& gaia_gurl_, |
| 237 const std::string& headers, | 237 const std::string& body, |
| 238 bool send_cookies, | 238 const std::string& headers, |
| 239 content::URLFetcherDelegate* delegate); | 239 bool send_cookies, |
| 240 content::URLFetcherDelegate* delegate); |
| 240 | 241 |
| 241 bool ShouldAutoFetch(AutoFetchLimit fetch_step); | 242 bool ShouldAutoFetch(AutoFetchLimit fetch_step); |
| 242 | 243 |
| 243 // These fields are common to GaiaOAuthFetcher, same every request | 244 // These fields are common to GaiaOAuthFetcher, same every request |
| 244 GaiaOAuthConsumer* const consumer_; | 245 GaiaOAuthConsumer* const consumer_; |
| 245 net::URLRequestContextGetter* const getter_; | 246 net::URLRequestContextGetter* const getter_; |
| 246 Profile* profile_; | 247 Profile* profile_; |
| 247 Browser* popup_; | 248 Browser* popup_; |
| 248 content::NotificationRegistrar registrar_; | 249 content::NotificationRegistrar registrar_; |
| 249 | 250 |
| 250 // While a fetch is going on: | 251 // While a fetch is going on: |
| 251 scoped_ptr<URLFetcher> fetcher_; | 252 scoped_ptr<content::URLFetcher> fetcher_; |
| 252 std::string request_body_; | 253 std::string request_body_; |
| 253 std::string request_headers_; | 254 std::string request_headers_; |
| 254 std::string service_scope_; | 255 std::string service_scope_; |
| 255 bool fetch_pending_; | 256 bool fetch_pending_; |
| 256 AutoFetchLimit auto_fetch_limit_; | 257 AutoFetchLimit auto_fetch_limit_; |
| 257 | 258 |
| 258 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher); | 259 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher); |
| 259 }; | 260 }; |
| 260 | 261 |
| 261 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ | 262 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ |
| OLD | NEW |