Chromium Code Reviews| 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 COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ | 5 #ifndef COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ |
| 6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ | 6 #define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <unordered_map> | 9 #include <unordered_map> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 // Creates the PaymentRequest that will interact with this |web_contents|. | 43 // Creates the PaymentRequest that will interact with this |web_contents|. |
| 44 void CreatePaymentRequest( | 44 void CreatePaymentRequest( |
| 45 content::WebContents* web_contents, | 45 content::WebContents* web_contents, |
| 46 std::unique_ptr<PaymentRequestDelegate> delegate, | 46 std::unique_ptr<PaymentRequestDelegate> delegate, |
| 47 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request, | 47 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request, |
| 48 PaymentRequest::ObserverForTest* observer_for_testing); | 48 PaymentRequest::ObserverForTest* observer_for_testing); |
| 49 | 49 |
| 50 // Destroys the given |request|. | 50 // Destroys the given |request|. |
| 51 void DestroyRequest(PaymentRequest* request); | 51 void DestroyRequest(PaymentRequest* request); |
| 52 | 52 |
| 53 // Called when |request| has received the show() call. Returns true if the | |
| 54 // |request| can be shown. (Only one request at a time can be shown per tab.) | |
|
Mathieu
2017/05/08 13:01:42
you should add that this manager will now assume t
please use gerrit instead
2017/05/08 13:12:35
Done.
| |
| 55 bool CanShow(PaymentRequest* request); | |
| 56 | |
| 53 private: | 57 private: |
| 54 explicit PaymentRequestWebContentsManager(content::WebContents* web_contents); | 58 explicit PaymentRequestWebContentsManager(content::WebContents* web_contents); |
| 55 friend class content::WebContentsUserData<PaymentRequestWebContentsManager>; | 59 friend class content::WebContentsUserData<PaymentRequestWebContentsManager>; |
| 56 friend class PaymentRequestBrowserTestBase; | 60 friend class PaymentRequestBrowserTestBase; |
| 57 | 61 |
| 58 // Owns all the PaymentRequest for this WebContents. Since the | 62 // Owns all the PaymentRequest for this WebContents. Since the |
| 59 // PaymentRequestWebContentsManager's lifetime is tied to the WebContents, | 63 // PaymentRequestWebContentsManager's lifetime is tied to the WebContents, |
| 60 // these requests only get destroyed when the WebContents goes away, or when | 64 // these requests only get destroyed when the WebContents goes away, or when |
| 61 // the requests themselves call DestroyRequest(). | 65 // the requests themselves call DestroyRequest(). |
| 62 std::unordered_map<PaymentRequest*, std::unique_ptr<PaymentRequest>> | 66 std::unordered_map<PaymentRequest*, std::unique_ptr<PaymentRequest>> |
|
Mathieu
2017/05/08 13:01:42
per Brett's email to chromium-dev, unordered_map i
please use gerrit instead
2017/05/08 13:12:35
Done.
| |
| 63 payment_requests_; | 67 payment_requests_; |
| 64 | 68 |
| 69 // The currently displayed instance of PaymentRequest. Points to one of the | |
| 70 // elements in payment_requests_. Can be null. | |
| 71 PaymentRequest* showing_; | |
| 72 | |
| 65 DISALLOW_COPY_AND_ASSIGN(PaymentRequestWebContentsManager); | 73 DISALLOW_COPY_AND_ASSIGN(PaymentRequestWebContentsManager); |
| 66 }; | 74 }; |
| 67 | 75 |
| 68 } // namespace payments | 76 } // namespace payments |
| 69 | 77 |
| 70 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ | 78 #endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_WEB_CONTENTS_MANAGER_H_ |
| OLD | NEW |