| 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/gcd_base_api_flow.h" | 10 #include "chrome/browser/local_discovery/gcd_base_api_flow.h" |
| 11 #include "net/url_request/url_request_context_getter.h" | 11 #include "net/url_request/url_request_context_getter.h" |
| 12 | 12 |
| 13 | 13 |
| 14 namespace local_discovery { | 14 namespace local_discovery { |
| 15 | 15 |
| 16 // API call flow for server-side communication with cloudprint for registration. | 16 // API call flow for server-side communication with cloudprint for registration. |
| 17 class PrivetConfirmApiCallFlow : public GCDBaseApiFlow::Delegate { | 17 class PrivetConfirmApiCallFlow : public CloudPrintApiFlowDelegate { |
| 18 public: | 18 public: |
| 19 typedef base::Callback<void(GCDBaseApiFlow::Status /*success*/)> | 19 typedef base::Callback<void(GCDBaseApiFlow::Status /*success*/)> |
| 20 ResponseCallback; | 20 ResponseCallback; |
| 21 | 21 |
| 22 // Create an OAuth2-based confirmation | 22 // Create an OAuth2-based confirmation |
| 23 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, | 23 PrivetConfirmApiCallFlow(net::URLRequestContextGetter* request_context, |
| 24 OAuth2TokenService* token_service_, | 24 OAuth2TokenService* token_service_, |
| 25 const std::string& account_id, | 25 const std::string& account_id, |
| 26 bool is_cloud_print, | |
| 27 const std::string& token, | 26 const std::string& token, |
| 28 const ResponseCallback& callback); | 27 const ResponseCallback& callback); |
| 29 | 28 |
| 30 virtual ~PrivetConfirmApiCallFlow(); | 29 virtual ~PrivetConfirmApiCallFlow(); |
| 31 | 30 |
| 32 void Start(); | 31 void Start(); |
| 33 | 32 |
| 34 virtual void OnGCDAPIFlowError(GCDBaseApiFlow* flow, | 33 virtual void OnGCDAPIFlowError(GCDBaseApiFlow* flow, |
| 35 GCDBaseApiFlow::Status status) OVERRIDE; | 34 GCDBaseApiFlow::Status status) OVERRIDE; |
| 36 virtual void OnGCDAPIFlowComplete(GCDBaseApiFlow* flow, | 35 virtual void OnGCDAPIFlowComplete(GCDBaseApiFlow* flow, |
| 37 const base::DictionaryValue* value) | 36 const base::DictionaryValue* value) |
| 38 OVERRIDE; | 37 OVERRIDE; |
| 39 virtual bool GCDIsCloudPrint() OVERRIDE; | |
| 40 virtual net::URLFetcher::RequestType GetRequestType() OVERRIDE; | 38 virtual net::URLFetcher::RequestType GetRequestType() OVERRIDE; |
| 41 virtual void GetUploadData(std::string* upload_type, | 39 |
| 42 std::string* upload_data) OVERRIDE; | 40 virtual GURL GetURL() OVERRIDE; |
| 43 | 41 |
| 44 GCDBaseApiFlow* GetBaseApiFlowForTests() { return &flow_; } | 42 GCDBaseApiFlow* GetBaseApiFlowForTests() { return &flow_; } |
| 45 | 43 |
| 46 private: | 44 private: |
| 47 bool is_cloud_print_; | |
| 48 GCDBaseApiFlow flow_; | 45 GCDBaseApiFlow flow_; |
| 49 ResponseCallback callback_; | 46 ResponseCallback callback_; |
| 47 std::string token_; |
| 50 }; | 48 }; |
| 51 | 49 |
| 52 } // namespace local_discovery | 50 } // namespace local_discovery |
| 53 | 51 |
| 54 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ | 52 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_CONFIRM_API_FLOW_H_ |
| OLD | NEW |