| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "chrome/browser/local_discovery/privet_http.h" | 10 #include "chrome/browser/local_discovery/privet_http.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 ERROR_NETWORK, | 26 ERROR_NETWORK, |
| 27 ERROR_HTTP_CODE, | 27 ERROR_HTTP_CODE, |
| 28 ERROR_FROM_SERVER, | 28 ERROR_FROM_SERVER, |
| 29 ERROR_MALFORMED_RESPONSE | 29 ERROR_MALFORMED_RESPONSE |
| 30 }; | 30 }; |
| 31 typedef base::Callback<void(Status /*success*/)> ResponseCallback; | 31 typedef base::Callback<void(Status /*success*/)> ResponseCallback; |
| 32 | 32 |
| 33 // Create an OAuth2-based confirmation | 33 // Create an OAuth2-based confirmation |
| 34 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, | 34 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, |
| 35 OAuth2TokenService* token_service_, | 35 OAuth2TokenService* token_service_, |
| 36 const std::string& account_id, |
| 36 const GURL& automated_claim_url, | 37 const GURL& automated_claim_url, |
| 37 const ResponseCallback& callback); | 38 const ResponseCallback& callback); |
| 38 | 39 |
| 39 // Create a cookie-based confirmation | 40 // Create a cookie-based confirmation |
| 40 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, | 41 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, |
| 41 int user_index, | 42 int user_index, |
| 42 const std::string& xsrf_token, | 43 const std::string& xsrf_token, |
| 43 const GURL& automated_claim_url, | 44 const GURL& automated_claim_url, |
| 44 const ResponseCallback& callback); | 45 const ResponseCallback& callback); |
| 45 | 46 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 59 | 60 |
| 60 private: | 61 private: |
| 61 bool UseOAuth2() { return token_service_ != NULL; } | 62 bool UseOAuth2() { return token_service_ != NULL; } |
| 62 | 63 |
| 63 void CreateRequest(const GURL& url); | 64 void CreateRequest(const GURL& url); |
| 64 | 65 |
| 65 scoped_ptr<net::URLFetcher> url_fetcher_; | 66 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 66 scoped_ptr<OAuth2TokenService::Request> oauth_request_; | 67 scoped_ptr<OAuth2TokenService::Request> oauth_request_; |
| 67 scoped_refptr<net::URLRequestContextGetter> request_context_; | 68 scoped_refptr<net::URLRequestContextGetter> request_context_; |
| 68 OAuth2TokenService* token_service_; | 69 OAuth2TokenService* token_service_; |
| 70 std::string account_id_; |
| 69 int user_index_; | 71 int user_index_; |
| 70 std::string xsrf_token_; | 72 std::string xsrf_token_; |
| 71 GURL automated_claim_url_; | 73 GURL automated_claim_url_; |
| 72 ResponseCallback callback_; | 74 ResponseCallback callback_; |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace local_discovery | 77 } // namespace local_discovery |
| 76 | 78 |
| 77 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ | 79 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ |
| OLD | NEW |