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 14 matching lines...) Expand all Loading... |
25 ERROR_TOKEN, | 25 ERROR_TOKEN, |
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 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, | 33 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, |
34 OAuth2TokenService* token_service_, | 34 OAuth2TokenService* token_service_, |
| 35 const std::string& account_id, |
35 const GURL& automated_claim_url, | 36 const GURL& automated_claim_url, |
36 const ResponseCallback& callback); | 37 const ResponseCallback& callback); |
37 virtual ~PrivetConfirmApiCallFlow(); | 38 virtual ~PrivetConfirmApiCallFlow(); |
38 | 39 |
39 void Start(); | 40 void Start(); |
40 | 41 |
41 // net::URLFetcherDelegate implementation: | 42 // net::URLFetcherDelegate implementation: |
42 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 43 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |
43 | 44 |
44 // OAuth2TokenService::Consumer implementation: | 45 // OAuth2TokenService::Consumer implementation: |
45 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 46 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
46 const std::string& access_token, | 47 const std::string& access_token, |
47 const base::Time& expiration_time) OVERRIDE; | 48 const base::Time& expiration_time) OVERRIDE; |
48 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 49 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
49 const GoogleServiceAuthError& error) OVERRIDE; | 50 const GoogleServiceAuthError& error) OVERRIDE; |
50 | 51 |
51 private: | 52 private: |
52 scoped_ptr<net::URLFetcher> url_fetcher_; | 53 scoped_ptr<net::URLFetcher> url_fetcher_; |
53 scoped_ptr<OAuth2TokenService::Request> oauth_request_; | 54 scoped_ptr<OAuth2TokenService::Request> oauth_request_; |
54 scoped_refptr<net::URLRequestContextGetter> request_context_; | 55 scoped_refptr<net::URLRequestContextGetter> request_context_; |
55 OAuth2TokenService* token_service_; | 56 OAuth2TokenService* token_service_; |
| 57 std::string account_id_; |
56 GURL automated_claim_url_; | 58 GURL automated_claim_url_; |
57 ResponseCallback callback_; | 59 ResponseCallback callback_; |
58 }; | 60 }; |
59 | 61 |
60 } // namespace local_discovery | 62 } // namespace local_discovery |
61 | 63 |
62 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ | 64 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ |
OLD | NEW |