OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
6 #define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
87 static GURL MakeGetAccessTokenUrl(); | 87 static GURL MakeGetAccessTokenUrl(); |
88 static std::string MakeGetAccessTokenBody( | 88 static std::string MakeGetAccessTokenBody( |
89 const std::string& client_id, | 89 const std::string& client_id, |
90 const std::string& client_secret, | 90 const std::string& client_secret, |
91 const std::string& refresh_token, | 91 const std::string& refresh_token, |
92 const std::vector<std::string>& scopes); | 92 const std::vector<std::string>& scopes); |
93 static bool ParseGetAccessTokenResponse(const net::URLFetcher* source, | 93 static bool ParseGetAccessTokenResponse(const net::URLFetcher* source, |
94 std::string* access_token, | 94 std::string* access_token, |
95 int* expires_in); | 95 int* expires_in); |
96 | 96 |
97 // Resets |last_fetcher_id_| to 0. | |
98 static void ResetLastFetcherIdForTest(); | |
fgorski
2013/08/29 23:37:44
To check in you will either need to make the metho
| |
99 | |
97 // State that is set during construction. | 100 // State that is set during construction. |
98 OAuth2AccessTokenConsumer* const consumer_; | 101 OAuth2AccessTokenConsumer* const consumer_; |
99 net::URLRequestContextGetter* const getter_; | 102 net::URLRequestContextGetter* const getter_; |
100 State state_; | 103 State state_; |
101 | 104 |
102 // While a fetch is in progress. | 105 // While a fetch is in progress. |
103 scoped_ptr<net::URLFetcher> fetcher_; | 106 scoped_ptr<net::URLFetcher> fetcher_; |
104 std::string client_id_; | 107 std::string client_id_; |
105 std::string client_secret_; | 108 std::string client_secret_; |
106 std::string refresh_token_; | 109 std::string refresh_token_; |
107 std::vector<std::string> scopes_; | 110 std::vector<std::string> scopes_; |
108 | 111 |
112 // The last fetcher id. | |
113 static int last_fetcher_id_; | |
114 | |
109 friend class OAuth2AccessTokenFetcherTest; | 115 friend class OAuth2AccessTokenFetcherTest; |
116 friend class OAuth2TokenServiceTest; | |
110 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, | 117 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, |
111 ParseGetAccessTokenResponse); | 118 ParseGetAccessTokenResponse); |
112 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, | 119 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, |
113 MakeGetAccessTokenBody); | 120 MakeGetAccessTokenBody); |
114 | 121 |
115 DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher); | 122 DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher); |
116 }; | 123 }; |
117 | 124 |
118 #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 125 #endif // GOOGLE_APIS_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
OLD | NEW |