| 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 #include "components/payments/content/payment_request_web_contents_manager.h" | 5 #include "components/payments/content/payment_request_web_contents_manager.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 content::WebContents* web_contents) { | 23 content::WebContents* web_contents) { |
| 24 DCHECK(web_contents); | 24 DCHECK(web_contents); |
| 25 // CreateForWebContents does nothing if the manager instance already exists. | 25 // CreateForWebContents does nothing if the manager instance already exists. |
| 26 PaymentRequestWebContentsManager::CreateForWebContents(web_contents); | 26 PaymentRequestWebContentsManager::CreateForWebContents(web_contents); |
| 27 return PaymentRequestWebContentsManager::FromWebContents(web_contents); | 27 return PaymentRequestWebContentsManager::FromWebContents(web_contents); |
| 28 } | 28 } |
| 29 | 29 |
| 30 void PaymentRequestWebContentsManager::CreatePaymentRequest( | 30 void PaymentRequestWebContentsManager::CreatePaymentRequest( |
| 31 content::WebContents* web_contents, | 31 content::WebContents* web_contents, |
| 32 std::unique_ptr<PaymentRequestDelegate> delegate, | 32 std::unique_ptr<PaymentRequestDelegate> delegate, |
| 33 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { | 33 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request, |
| 34 PaymentRequest::ObserverForTest* observer_for_testing) { |
| 34 auto new_request = base::MakeUnique<PaymentRequest>( | 35 auto new_request = base::MakeUnique<PaymentRequest>( |
| 35 web_contents, std::move(delegate), this, std::move(request)); | 36 web_contents, std::move(delegate), this, std::move(request), |
| 37 observer_for_testing); |
| 36 PaymentRequest* request_ptr = new_request.get(); | 38 PaymentRequest* request_ptr = new_request.get(); |
| 37 payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request))); | 39 payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request))); |
| 38 } | 40 } |
| 39 | 41 |
| 40 void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) { | 42 void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) { |
| 41 payment_requests_.erase(request); | 43 payment_requests_.erase(request); |
| 42 } | 44 } |
| 43 | 45 |
| 44 PaymentRequestWebContentsManager::PaymentRequestWebContentsManager( | 46 PaymentRequestWebContentsManager::PaymentRequestWebContentsManager( |
| 45 content::WebContents* web_contents) {} | 47 content::WebContents* web_contents) {} |
| 46 | 48 |
| 47 } // namespace payments | 49 } // namespace payments |
| OLD | NEW |