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_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 5 #ifndef CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
6 #define CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 6 #define CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 GET_ACCESS_TOKEN_DONE, | 69 GET_ACCESS_TOKEN_DONE, |
70 ERROR_STATE, | 70 ERROR_STATE, |
71 }; | 71 }; |
72 | 72 |
73 // Helper methods for the flow. | 73 // Helper methods for the flow. |
74 void StartGetAccessToken(); | 74 void StartGetAccessToken(); |
75 void EndGetAccessToken(const content::URLFetcher* source); | 75 void EndGetAccessToken(const content::URLFetcher* source); |
76 | 76 |
77 // Helper mehtods for reporting back results. | 77 // Helper mehtods for reporting back results. |
78 void OnGetTokenSuccess(const std::string& access_token); | 78 void OnGetTokenSuccess(const std::string& access_token); |
79 void OnGetTokenFailure(GoogleServiceAuthError error); | 79 void OnGetTokenFailure(const GoogleServiceAuthError& error); |
80 | 80 |
81 // Other helpers. | 81 // Other helpers. |
82 static GURL MakeGetAccessTokenUrl(); | 82 static GURL MakeGetAccessTokenUrl(); |
83 static std::string MakeGetAccessTokenBody( | 83 static std::string MakeGetAccessTokenBody( |
84 const std::string& client_id, | 84 const std::string& client_id, |
85 const std::string& client_secret, | 85 const std::string& client_secret, |
86 const std::string& refresh_token, | 86 const std::string& refresh_token, |
87 const std::vector<std::string>& scopes); | 87 const std::vector<std::string>& scopes); |
88 static bool ParseGetAccessTokenResponse(const content::URLFetcher* source, | 88 static bool ParseGetAccessTokenResponse(const content::URLFetcher* source, |
89 std::string* access_token); | 89 std::string* access_token); |
(...skipping 13 matching lines...) Expand all Loading... |
103 friend class OAuth2AccessTokenFetcherTest; | 103 friend class OAuth2AccessTokenFetcherTest; |
104 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, | 104 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, |
105 ParseGetAccessTokenResponse); | 105 ParseGetAccessTokenResponse); |
106 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, | 106 FRIEND_TEST_ALL_PREFIXES(OAuth2AccessTokenFetcherTest, |
107 MakeGetAccessTokenBody); | 107 MakeGetAccessTokenBody); |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher); | 109 DISALLOW_COPY_AND_ASSIGN(OAuth2AccessTokenFetcher); |
110 }; | 110 }; |
111 | 111 |
112 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ | 112 #endif // CHROME_COMMON_NET_GAIA_OAUTH2_ACCESS_TOKEN_FETCHER_H_ |
OLD | NEW |