| 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 | 10 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 OAUTH1_REQUEST_TOKEN, | 46 OAUTH1_REQUEST_TOKEN, |
| 47 OAUTH1_ALL_ACCESS_TOKEN, | 47 OAUTH1_ALL_ACCESS_TOKEN, |
| 48 OAUTH2_SERVICE_ACCESS_TOKEN, | 48 OAUTH2_SERVICE_ACCESS_TOKEN, |
| 49 USER_INFO, | 49 USER_INFO, |
| 50 ALL_OAUTH_STEPS, | 50 ALL_OAUTH_STEPS, |
| 51 } AutoFetchLimit; | 51 } AutoFetchLimit; |
| 52 | 52 |
| 53 GaiaOAuthFetcher(GaiaOAuthConsumer* consumer, | 53 GaiaOAuthFetcher(GaiaOAuthConsumer* consumer, |
| 54 net::URLRequestContextGetter* getter, | 54 net::URLRequestContextGetter* getter, |
| 55 Profile* profile, | 55 Profile* profile, |
| 56 const std::string& service_name, | |
| 57 const std::string& service_scope); | 56 const std::string& service_scope); |
| 58 | 57 |
| 59 virtual ~GaiaOAuthFetcher(); | 58 virtual ~GaiaOAuthFetcher(); |
| 60 | 59 |
| 61 // Sets the mask of which OAuth fetch steps should be automatically kicked | 60 // Sets the mask of which OAuth fetch steps should be automatically kicked |
| 62 // of upon successful completition of the previous steps. By default, | 61 // of upon successful completition of the previous steps. By default, |
| 63 // this class will chain all steps in OAuth proccess. | 62 // this class will chain all steps in OAuth proccess. |
| 64 void SetAutoFetchLimit(AutoFetchLimit limit) { auto_fetch_limit_ = limit; } | 63 void SetAutoFetchLimit(AutoFetchLimit limit) { auto_fetch_limit_ = limit; } |
| 65 | 64 |
| 66 // Obtains an OAuth 1 request token | 65 // Obtains an OAuth 1 request token |
| (...skipping 19 matching lines...) Expand all Loading... |
| 86 const std::string& oauth1_request_token); | 85 const std::string& oauth1_request_token); |
| 87 | 86 |
| 88 // Obtains an OAuth2 access token using Gaia's OAuth1-to-OAuth2 bridge. | 87 // Obtains an OAuth2 access token using Gaia's OAuth1-to-OAuth2 bridge. |
| 89 // | 88 // |
| 90 // oauth1_access_token and oauth1_access_token_secret are from | 89 // oauth1_access_token and oauth1_access_token_secret are from |
| 91 // OAuthGetAccessToken's result. | 90 // OAuthGetAccessToken's result. |
| 92 // | 91 // |
| 93 // wrap_token_duration is typically one hour, | 92 // wrap_token_duration is typically one hour, |
| 94 // which is also the max -- you can only decrease it. | 93 // which is also the max -- you can only decrease it. |
| 95 // | 94 // |
| 96 // service_name and service_scope should be specific to a service. For | 95 // service_scope will be used as a service name. For example, Chromium Sync |
| 97 // example, Chromium Sync uses https://www.googleapis.com/auth/chromesync as | 96 // uses https://www.googleapis.com/auth/chromesync for its OAuth2 service |
| 98 // its OAuth2 service scope. | 97 // scope here as well as for its service name in TokenService. |
| 99 virtual void StartOAuthWrapBridge( | 98 virtual void StartOAuthWrapBridge( |
| 100 const std::string& oauth1_access_token, | 99 const std::string& oauth1_access_token, |
| 101 const std::string& oauth1_access_token_secret, | 100 const std::string& oauth1_access_token_secret, |
| 102 const std::string& wrap_token_duration, | 101 const std::string& wrap_token_duration, |
| 103 const std::string& service_name, | |
| 104 const std::string& service_scope); | 102 const std::string& service_scope); |
| 105 | 103 |
| 106 // Obtains user information related to an OAuth2 access token | 104 // Obtains user information related to an OAuth2 access token |
| 107 // | 105 // |
| 108 // oauth2_access_token is from OAuthWrapBridge's result. | 106 // oauth2_access_token is from OAuthWrapBridge's result. |
| 109 virtual void StartUserInfo(const std::string& oauth2_access_token); | 107 virtual void StartUserInfo(const std::string& oauth2_access_token); |
| 110 | 108 |
| 111 // NotificationObserver implementation. | 109 // NotificationObserver implementation. |
| 112 virtual void Observe(int type, | 110 virtual void Observe(int type, |
| 113 const NotificationSource& source, | 111 const NotificationSource& source, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 GaiaOAuthConsumer* const consumer_; | 231 GaiaOAuthConsumer* const consumer_; |
| 234 net::URLRequestContextGetter* const getter_; | 232 net::URLRequestContextGetter* const getter_; |
| 235 Profile* profile_; | 233 Profile* profile_; |
| 236 Browser* popup_; | 234 Browser* popup_; |
| 237 NotificationRegistrar registrar_; | 235 NotificationRegistrar registrar_; |
| 238 | 236 |
| 239 // While a fetch is going on: | 237 // While a fetch is going on: |
| 240 scoped_ptr<URLFetcher> fetcher_; | 238 scoped_ptr<URLFetcher> fetcher_; |
| 241 std::string request_body_; | 239 std::string request_body_; |
| 242 std::string request_headers_; | 240 std::string request_headers_; |
| 243 std::string service_name_; | |
| 244 std::string service_scope_; | 241 std::string service_scope_; |
| 245 bool fetch_pending_; | 242 bool fetch_pending_; |
| 246 AutoFetchLimit auto_fetch_limit_; | 243 AutoFetchLimit auto_fetch_limit_; |
| 247 | 244 |
| 248 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher); | 245 DISALLOW_COPY_AND_ASSIGN(GaiaOAuthFetcher); |
| 249 }; | 246 }; |
| 250 | 247 |
| 251 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ | 248 #endif // CHROME_BROWSER_NET_GAIA_GAIA_OAUTH_FETCHER_H_ |
| OLD | NEW |