| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 namespace autofill { | 10 namespace autofill { |
| 9 | 11 |
| 10 class AutofillClient; | 12 class AutofillClient; |
| 11 | 13 |
| 12 namespace payments { | 14 namespace payments { |
| 13 | 15 |
| 14 class PaymentsClientDelegate; | 16 class PaymentsClientDelegate; |
| 15 | 17 |
| 16 // Interface for the various Payments request types. | 18 // Interface for the various Payments request types. |
| 17 class PaymentsRequest { | 19 class PaymentsRequest { |
| 18 public: | 20 public: |
| 19 virtual ~PaymentsRequest() {} | 21 virtual ~PaymentsRequest() {} |
| 20 | 22 |
| 21 // Returns the URL path for this type of request. | 23 // Returns the URL path for this type of request. |
| 22 virtual std::string GetRequestUrlPath() = 0; | 24 virtual std::string GetRequestUrlPath() = 0; |
| 23 | 25 |
| 24 // Returns the content type that should be used in the HTTP request. | 26 // Returns the content type that should be used in the HTTP request. |
| 25 virtual std::string GetRequestContentType() = 0; | 27 virtual std::string GetRequestContentType() = 0; |
| 26 | 28 |
| 27 // Returns the content that should be provided in the HTTP request. | 29 // Returns the content that should be provided in the HTTP request. |
| 28 virtual std::string GetRequestContent() = 0; | 30 virtual std::string GetRequestContent() = 0; |
| 29 | 31 |
| 30 // Parses the required elements of the HTTP response. | 32 // Parses the required elements of the HTTP response. |
| 31 virtual void ParseResponse(scoped_ptr<base::DictionaryValue> response) = 0; | 33 virtual void ParseResponse( |
| 34 std::unique_ptr<base::DictionaryValue> response) = 0; |
| 32 | 35 |
| 33 // Returns true if all of the required elements were successfully retrieved by | 36 // Returns true if all of the required elements were successfully retrieved by |
| 34 // a call to ParseResponse. | 37 // a call to ParseResponse. |
| 35 virtual bool IsResponseComplete() = 0; | 38 virtual bool IsResponseComplete() = 0; |
| 36 | 39 |
| 37 // Invokes the appropriate callback in the delegate based on what type of | 40 // Invokes the appropriate callback in the delegate based on what type of |
| 38 // request this is. | 41 // request this is. |
| 39 virtual void RespondToDelegate(PaymentsClientDelegate* delegate, | 42 virtual void RespondToDelegate(PaymentsClientDelegate* delegate, |
| 40 AutofillClient::PaymentsRpcResult result) = 0; | 43 AutofillClient::PaymentsRpcResult result) = 0; |
| 41 }; | 44 }; |
| 42 | 45 |
| 43 } // namespace payments | 46 } // namespace payments |
| 44 } // namespace autofill | 47 } // namespace autofill |
| 45 | 48 |
| 46 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ | 49 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_REQUEST_H_ |
| OLD | NEW |