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_API_CALL_FLOW_H_ | 5 #ifndef GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
6 #define GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 6 #define GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // net::URLFetcherDelegate implementation. | 60 // net::URLFetcherDelegate implementation. |
61 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 61 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
62 | 62 |
63 protected: | 63 protected: |
64 // Template methods for sub-classes. | 64 // Template methods for sub-classes. |
65 | 65 |
66 // Methods to help create HTTP request. | 66 // Methods to help create HTTP request. |
67 virtual GURL CreateApiCallUrl() = 0; | 67 virtual GURL CreateApiCallUrl() = 0; |
68 virtual std::string CreateApiCallBody() = 0; | 68 virtual std::string CreateApiCallBody() = 0; |
| 69 virtual std::string CreateApiCallBodyContentType(); |
69 | 70 |
70 // Sub-classes can expose an appropriate observer interface by implementing | 71 // Sub-classes can expose an appropriate observer interface by implementing |
71 // these template methods. | 72 // these template methods. |
72 // Called when the API call finished successfully. | 73 // Called when the API call finished successfully. |
73 virtual void ProcessApiCallSuccess(const net::URLFetcher* source) = 0; | 74 virtual void ProcessApiCallSuccess(const net::URLFetcher* source) = 0; |
74 // Called when the API call failed. | 75 // Called when the API call failed. |
75 virtual void ProcessApiCallFailure(const net::URLFetcher* source) = 0; | 76 virtual void ProcessApiCallFailure(const net::URLFetcher* source) = 0; |
76 // Called when a new access token is generated. | 77 // Called when a new access token is generated. |
77 virtual void ProcessNewAccessToken(const std::string& access_token) = 0; | 78 virtual void ProcessNewAccessToken(const std::string& access_token) = 0; |
78 virtual void ProcessMintAccessTokenFailure( | 79 virtual void ProcessMintAccessTokenFailure( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 // Whether we have already tried minting an access token once. | 120 // Whether we have already tried minting an access token once. |
120 bool tried_mint_access_token_; | 121 bool tried_mint_access_token_; |
121 | 122 |
122 scoped_ptr<net::URLFetcher> url_fetcher_; | 123 scoped_ptr<net::URLFetcher> url_fetcher_; |
123 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_; | 124 scoped_ptr<OAuth2AccessTokenFetcher> oauth2_access_token_fetcher_; |
124 | 125 |
125 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); | 126 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); |
126 }; | 127 }; |
127 | 128 |
128 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 129 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
OLD | NEW |