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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "net/url_request/url_fetcher.h" | 12 #include "net/url_request/url_fetcher.h" |
13 #include "net/url_request/url_fetcher_delegate.h" | 13 #include "net/url_request/url_fetcher_delegate.h" |
14 #include "url/gurl.h" | 14 #include "url/gurl.h" |
15 | 15 |
16 class GoogleServiceAuthError; | 16 class GoogleServiceAuthError; |
17 class OAuth2MintTokenFlowTest; | 17 class OAuth2MintTokenFlowTest; |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class URLFetcher; | 20 class URLFetcher; |
21 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 INITIAL, | 63 INITIAL, |
64 API_CALL_STARTED, | 64 API_CALL_STARTED, |
65 API_CALL_DONE, | 65 API_CALL_DONE, |
66 ERROR_STATE | 66 ERROR_STATE |
67 }; | 67 }; |
68 | 68 |
69 // Creates an instance of URLFetcher that does not send or save cookies. | 69 // Creates an instance of URLFetcher that does not send or save cookies. |
70 // Template method CreateApiCallUrl is used to get the URL. | 70 // Template method CreateApiCallUrl is used to get the URL. |
71 // Template method CreateApiCallBody is used to get the body. | 71 // Template method CreateApiCallBody is used to get the body. |
72 // The URLFether's method will be GET if body is empty, POST otherwise. | 72 // The URLFether's method will be GET if body is empty, POST otherwise. |
73 scoped_ptr<net::URLFetcher> CreateURLFetcher( | 73 std::unique_ptr<net::URLFetcher> CreateURLFetcher( |
74 net::URLRequestContextGetter* context, | 74 net::URLRequestContextGetter* context, |
75 const std::string& access_token); | 75 const std::string& access_token); |
76 | 76 |
77 // Helper methods to implement the state machine for the flow. | 77 // Helper methods to implement the state machine for the flow. |
78 void BeginApiCall(); | 78 void BeginApiCall(); |
79 void EndApiCall(const net::URLFetcher* source); | 79 void EndApiCall(const net::URLFetcher* source); |
80 | 80 |
81 State state_; | 81 State state_; |
82 scoped_ptr<net::URLFetcher> url_fetcher_; | 82 std::unique_ptr<net::URLFetcher> url_fetcher_; |
83 | 83 |
84 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); | 84 DISALLOW_COPY_AND_ASSIGN(OAuth2ApiCallFlow); |
85 }; | 85 }; |
86 | 86 |
87 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ | 87 #endif // GOOGLE_APIS_GAIA_OAUTH2_API_CALL_FLOW_H_ |
OLD | NEW |