Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Side by Side Diff: components/payments/payment_request_web_contents_manager.cc

Issue 2611253004: [Payment Request] Change the lifetime management of PaymentRequestImpl (Closed)
Patch Set: added a browser test Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698