Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
please use gerrit instead
2017/01/06 21:49:10
2017
Mathieu
2017/01/07 05:03:08
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "components/payments/payment_request_web_contents_manager.h" | |
| 6 | |
| 7 #include <memory> | |
| 8 #include <utility> | |
| 9 | |
| 10 #include "components/payments/payment_request_delegate.h" | |
| 11 | |
| 12 DEFINE_WEB_CONTENTS_USER_DATA_KEY(payments::PaymentRequestWebContentsManager); | |
| 13 | |
| 14 namespace payments { | |
| 15 | |
| 16 PaymentRequestWebContentsManager::~PaymentRequestWebContentsManager() {} | |
| 17 | |
| 18 PaymentRequestWebContentsManager* | |
| 19 PaymentRequestWebContentsManager::GetOrCreateForWebContents( | |
| 20 content::WebContents* web_contents) { | |
| 21 DCHECK(web_contents); | |
|
please use gerrit instead
2017/01/06 21:49:10
#include "base/logging.h"
Mathieu
2017/01/07 05:03:07
Done.
| |
| 22 // CreateForWebContents does nothing if the delegate instance already exists. | |
| 23 PaymentRequestWebContentsManager::CreateForWebContents(web_contents); | |
| 24 return PaymentRequestWebContentsManager::FromWebContents(web_contents); | |
| 25 } | |
| 26 | |
| 27 void PaymentRequestWebContentsManager::CreatePaymentRequestImpl( | |
| 28 content::WebContents* web_contents, | |
| 29 std::unique_ptr<PaymentRequestDelegate> delegate, | |
| 30 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) { | |
| 31 std::unique_ptr<PaymentRequestImpl> new_request(new PaymentRequestImpl( | |
| 32 web_contents, std::move(delegate), this, std::move(request))); | |
| 33 payment_requests_.insert( | |
| 34 std::make_pair(new_request.get(), std::move(new_request))); | |
|
please use gerrit instead
2017/01/06 21:49:10
Different compilers evaluate the order of paramete
Mathieu
2017/01/07 05:03:07
Oh wow, OK. I'm caching the raw pointer now, that
| |
| 35 } | |
| 36 | |
| 37 void PaymentRequestWebContentsManager::DestroyRequest( | |
| 38 PaymentRequestImpl* request) { | |
| 39 payment_requests_.erase(request); | |
| 40 } | |
| 41 | |
| 42 PaymentRequestWebContentsManager::PaymentRequestWebContentsManager( | |
| 43 content::WebContents* web_contents) {} | |
| 44 | |
| 45 } // namespace payments | |
| OLD | NEW |