OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ | 5 #ifndef GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ |
6 #define GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ | 6 #define GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "base/timer/timer.h" | 11 #include "base/timer/timer.h" |
11 #include "google_apis/gaia/gaia_auth_consumer.h" | 12 #include "google_apis/gaia/gaia_auth_consumer.h" |
12 #include "google_apis/gaia/oauth2_token_service.h" | 13 #include "google_apis/gaia/oauth2_token_service.h" |
13 | 14 |
14 // Allow to retrieves an uber-auth token for the user. This class uses the | 15 // Allow to retrieves an uber-auth token for the user. This class uses the |
15 // |OAuth2TokenService| and considers that the user is already logged in. It | 16 // |OAuth2TokenService| and considers that the user is already logged in. It |
16 // will use the OAuth2 access token to generate the uber-auth token. | 17 // will use the OAuth2 access token to generate the uber-auth token. |
17 // | 18 // |
18 // This class should be used on a single thread, but it can be whichever thread | 19 // This class should be used on a single thread, but it can be whichever thread |
19 // that you like. | 20 // that you like. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void RequestAccessToken(); | 81 void RequestAccessToken(); |
81 | 82 |
82 // Exchanges an oauth2 access token for an uber-auth token. | 83 // Exchanges an oauth2 access token for an uber-auth token. |
83 void ExchangeTokens(); | 84 void ExchangeTokens(); |
84 | 85 |
85 OAuth2TokenService* token_service_; | 86 OAuth2TokenService* token_service_; |
86 UbertokenConsumer* consumer_; | 87 UbertokenConsumer* consumer_; |
87 std::string source_; | 88 std::string source_; |
88 net::URLRequestContextGetter* request_context_; | 89 net::URLRequestContextGetter* request_context_; |
89 GaiaAuthFetcherFactory gaia_auth_fetcher_factory_; | 90 GaiaAuthFetcherFactory gaia_auth_fetcher_factory_; |
90 scoped_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; | 91 std::unique_ptr<GaiaAuthFetcher> gaia_auth_fetcher_; |
91 scoped_ptr<OAuth2TokenService::Request> access_token_request_; | 92 std::unique_ptr<OAuth2TokenService::Request> access_token_request_; |
92 std::string account_id_; | 93 std::string account_id_; |
93 std::string access_token_; | 94 std::string access_token_; |
94 int retry_number_; | 95 int retry_number_; |
95 base::OneShotTimer retry_timer_; | 96 base::OneShotTimer retry_timer_; |
96 bool second_access_token_request_; | 97 bool second_access_token_request_; |
97 | 98 |
98 DISALLOW_COPY_AND_ASSIGN(UbertokenFetcher); | 99 DISALLOW_COPY_AND_ASSIGN(UbertokenFetcher); |
99 }; | 100 }; |
100 | 101 |
101 #endif // GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ | 102 #endif // GOOGLE_APIS_GAIA_UBERTOKEN_FETCHER_H_ |
OLD | NEW |