| 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_CLIENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_CLIENT_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_CLIENT_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 UploadRequestDetails(); | 84 UploadRequestDetails(); |
| 85 UploadRequestDetails(const UploadRequestDetails& other); | 85 UploadRequestDetails(const UploadRequestDetails& other); |
| 86 ~UploadRequestDetails(); | 86 ~UploadRequestDetails(); |
| 87 | 87 |
| 88 CreditCard card; | 88 CreditCard card; |
| 89 base::string16 cvc; | 89 base::string16 cvc; |
| 90 std::vector<AutofillProfile> profiles; | 90 std::vector<AutofillProfile> profiles; |
| 91 base::string16 context_token; | 91 base::string16 context_token; |
| 92 std::string risk_data; | 92 std::string risk_data; |
| 93 std::string app_locale; | 93 std::string app_locale; |
| 94 std::vector<const char*> active_experiments; |
| 94 }; | 95 }; |
| 95 | 96 |
| 96 // |context_getter| is reference counted so it has no lifetime or ownership | 97 // |context_getter| is reference counted so it has no lifetime or ownership |
| 97 // requirements. |delegate| must outlive |this|. |source_url| is the url | 98 // requirements. |delegate| must outlive |this|. |source_url| is the url |
| 98 // of the merchant page. | 99 // of the merchant page. |
| 99 PaymentsClient(net::URLRequestContextGetter* context_getter, | 100 PaymentsClient(net::URLRequestContextGetter* context_getter, |
| 100 PaymentsClientDelegate* delegate); | 101 PaymentsClientDelegate* delegate); |
| 101 | 102 |
| 102 ~PaymentsClient() override; | 103 ~PaymentsClient() override; |
| 103 | 104 |
| 104 // Starts fetching the OAuth2 token in anticipation of future Payments | 105 // Starts fetching the OAuth2 token in anticipation of future Payments |
| 105 // requests. Called as an optimization, but not strictly necessary. Should | 106 // requests. Called as an optimization, but not strictly necessary. Should |
| 106 // *not* be called in advance of GetUploadDetails or UploadCard because | 107 // *not* be called in advance of GetUploadDetails or UploadCard because |
| 107 // identifying information should not be sent until the user has explicitly | 108 // identifying information should not be sent until the user has explicitly |
| 108 // accepted an upload prompt. | 109 // accepted an upload prompt. |
| 109 void Prepare(); | 110 void Prepare(); |
| 110 | 111 |
| 111 // The user has attempted to unmask a card with the given cvc. | 112 // The user has attempted to unmask a card with the given cvc. |
| 112 void UnmaskCard(const UnmaskRequestDetails& request_details); | 113 void UnmaskCard(const UnmaskRequestDetails& request_details); |
| 113 | 114 |
| 114 // Determine if the user meets the Payments service's conditions for upload. | 115 // Determine if the user meets the Payments service's conditions for upload. |
| 115 // The service uses |addresses| (from which names and phone numbers are | 116 // The service uses |addresses| (from which names and phone numbers are |
| 116 // removed) and |app_locale| to determine which legal message to display. If | 117 // removed) and |app_locale| to determine which legal message to display. If |
| 117 // the conditions are met, the legal message will be returned via | 118 // the conditions are met, the legal message will be returned via |
| 118 // OnDidGetUploadDetails. | 119 // OnDidGetUploadDetails. |active_experiments| is used by payments server to |
| 119 virtual void GetUploadDetails(const std::vector<AutofillProfile>& addresses, | 120 // track requests that were triggered by enabled features. |
| 120 const std::string& app_locale); | 121 virtual void GetUploadDetails( |
| 122 const std::vector<AutofillProfile>& addresses, |
| 123 const std::vector<const char*>& active_experiments, |
| 124 const std::string& app_locale); |
| 121 | 125 |
| 122 // The user has indicated that they would like to upload a card with the given | 126 // The user has indicated that they would like to upload a card with the given |
| 123 // cvc. This request will fail server-side if a successful call to | 127 // cvc. This request will fail server-side if a successful call to |
| 124 // GetUploadDetails has not already been made. | 128 // GetUploadDetails has not already been made. |
| 125 virtual void UploadCard(const UploadRequestDetails& details); | 129 virtual void UploadCard(const UploadRequestDetails& details); |
| 126 | 130 |
| 127 // Cancels and clears the current |request_|. | 131 // Cancels and clears the current |request_|. |
| 128 void CancelRequest(); | 132 void CancelRequest(); |
| 129 | 133 |
| 130 private: | 134 private: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 182 |
| 179 base::WeakPtrFactory<PaymentsClient> weak_ptr_factory_; | 183 base::WeakPtrFactory<PaymentsClient> weak_ptr_factory_; |
| 180 | 184 |
| 181 DISALLOW_COPY_AND_ASSIGN(PaymentsClient); | 185 DISALLOW_COPY_AND_ASSIGN(PaymentsClient); |
| 182 }; | 186 }; |
| 183 | 187 |
| 184 } // namespace payments | 188 } // namespace payments |
| 185 } // namespace autofill | 189 } // namespace autofill |
| 186 | 190 |
| 187 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_CLIENT_H_ | 191 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PAYMENTS_PAYMENTS_CLIENT_H_ |
| OLD | NEW |