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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 INITIAL, | 57 INITIAL, |
58 API_CALL_STARTED, | 58 API_CALL_STARTED, |
59 API_CALL_DONE, | 59 API_CALL_DONE, |
60 ERROR_STATE | 60 ERROR_STATE |
61 }; | 61 }; |
62 | 62 |
63 // Creates an instance of URLFetcher that does not send or save cookies. | 63 // Creates an instance of URLFetcher that does not send or save cookies. |
64 // Template method CreateApiCallUrl is used to get the URL. | 64 // Template method CreateApiCallUrl is used to get the URL. |
65 // Template method CreateApiCallBody is used to get the body. | 65 // Template method CreateApiCallBody is used to get the body. |
66 // The URLFether's method will be GET if body is empty, POST otherwise. | 66 // The URLFether's method will be GET if body is empty, POST otherwise. |
67 // Caller owns the returned instance. | 67 scoped_ptr<net::URLFetcher> CreateURLFetcher( |
68 net::URLFetcher* CreateURLFetcher(net::URLRequestContextGetter* context, | 68 net::URLRequestContextGetter* context, |
69 const std::string& access_token); | 69 const std::string& access_token); |
70 | 70 |
71 // Helper methods to implement the state machine for the flow. | 71 // Helper methods to implement the state machine for the flow. |
72 void BeginApiCall(); | 72 void BeginApiCall(); |
73 void EndApiCall(const net::URLFetcher* source); | 73 void EndApiCall(const net::URLFetcher* source); |
74 | 74 |
75 State state_; | 75 State state_; |
76 scoped_ptr<net::URLFetcher> url_fetcher_; | 76 scoped_ptr<net::URLFetcher> url_fetcher_; |
77 | 77 |
78 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); | 78 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); |
79 }; | 79 }; |
80 | 80 |
81 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 81 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
OLD | NEW |