OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 5 #ifndef CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
6 #define CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 6 #define CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "components/payments/core/payment_request_delegate.h" | 12 #include "components/payments/core/payment_request_delegate.h" |
13 | 13 |
14 namespace content { | 14 namespace content { |
15 class WebContents; | 15 class WebContents; |
16 } | 16 } |
17 | 17 |
18 namespace payments { | 18 namespace payments { |
19 | 19 |
20 class PaymentRequestDialog; | 20 class PaymentRequestDialog; |
21 | 21 |
22 class ChromePaymentRequestDelegate : public PaymentRequestDelegate { | 22 class ChromePaymentRequestDelegate : public PaymentRequestDelegate { |
23 public: | 23 public: |
24 explicit ChromePaymentRequestDelegate(content::WebContents* web_contents); | 24 explicit ChromePaymentRequestDelegate(content::WebContents* web_contents); |
25 ~ChromePaymentRequestDelegate() override {} | 25 ~ChromePaymentRequestDelegate() override; |
26 | 26 |
27 // PaymentRequestDelegate: | 27 // PaymentRequestDelegate: |
28 void ShowDialog(PaymentRequest* request) override; | 28 void ShowDialog(PaymentRequest* request) override; |
29 void CloseDialog() override; | 29 void CloseDialog() override; |
30 void ShowErrorMessage() override; | 30 void ShowErrorMessage() override; |
31 autofill::PersonalDataManager* GetPersonalDataManager() override; | 31 autofill::PersonalDataManager* GetPersonalDataManager() override; |
32 const std::string& GetApplicationLocale() const override; | 32 const std::string& GetApplicationLocale() const override; |
33 bool IsIncognito() const override; | 33 bool IsIncognito() const override; |
34 bool IsSslCertificateValid() override; | 34 bool IsSslCertificateValid() override; |
35 const GURL& GetLastCommittedURL() const override; | 35 const GURL& GetLastCommittedURL() const override; |
36 void DoFullCardRequest( | 36 void DoFullCardRequest( |
37 const autofill::CreditCard& credit_card, | 37 const autofill::CreditCard& credit_card, |
38 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> | 38 base::WeakPtr<autofill::payments::FullCardRequest::ResultDelegate> |
39 result_delegate) override; | 39 result_delegate) override; |
40 std::unique_ptr<const ::i18n::addressinput::Source> GetAddressInputSource() | 40 std::unique_ptr<::i18n::addressinput::Source> GetAddressInputSource() |
41 override; | 41 override; |
42 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() | 42 std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() |
43 override; | 43 override; |
44 AddressNormalizer* GetAddressNormalizer() override; | |
44 | 45 |
45 protected: | 46 protected: |
46 // Reference to the dialog so that we can satisfy calls to CloseDialog(). This | 47 // Reference to the dialog so that we can satisfy calls to CloseDialog(). This |
47 // reference is invalid once CloseDialog() has been called on it, because the | 48 // reference is invalid once CloseDialog() has been called on it, because the |
48 // dialog will be destroyed. Protected for testing. | 49 // dialog will be destroyed. Protected for testing. |
49 PaymentRequestDialog* dialog_; | 50 PaymentRequestDialog* dialog_; |
50 | 51 |
51 private: | 52 private: |
52 // Not owned but outlives the PaymentRequest object that owns this. | 53 // Not owned but outlives the PaymentRequest object that owns this. |
53 content::WebContents* web_contents_; | 54 content::WebContents* web_contents_; |
54 | 55 |
56 // The address normalizer to use for the duration of the Payment Request. | |
57 std::unique_ptr<AddressNormalizer> address_normalizer_; | |
please use gerrit instead
2017/04/20 20:15:20
No point of using std::unique_ptr if the variable
sebsg
2017/04/20 21:06:19
Done.
| |
58 | |
55 DISALLOW_COPY_AND_ASSIGN(ChromePaymentRequestDelegate); | 59 DISALLOW_COPY_AND_ASSIGN(ChromePaymentRequestDelegate); |
56 }; | 60 }; |
57 | 61 |
58 } // namespace payments | 62 } // namespace payments |
59 | 63 |
60 #endif // CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ | 64 #endif // CHROME_BROWSER_PAYMENTS_CHROME_PAYMENT_REQUEST_DELEGATE_H_ |
OLD | NEW |