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

Unified Diff: components/payments/payment_request_web_contents_manager.cc

Issue 2611253004: [Payment Request] Change the lifetime management of PaymentRequestImpl (Closed)
Patch Set: PaymentRequestImpl -> PaymentRequest 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/payments/payment_request_web_contents_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/payments/payment_request_web_contents_manager.cc
diff --git a/components/payments/payment_request_web_contents_manager.cc b/components/payments/payment_request_web_contents_manager.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bb358f921345e494a0a520db3d5aa9619a545a45
--- /dev/null
+++ b/components/payments/payment_request_web_contents_manager.cc
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/payments/payment_request_web_contents_manager.h"
+
+#include <memory>
+#include <utility>
+
+#include "base/logging.h"
+#include "components/payments/payment_request_delegate.h"
+
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(payments::PaymentRequestWebContentsManager);
+
+namespace payments {
+
+PaymentRequestWebContentsManager::~PaymentRequestWebContentsManager() {}
+
+PaymentRequestWebContentsManager*
+PaymentRequestWebContentsManager::GetOrCreateForWebContents(
+ content::WebContents* web_contents) {
+ DCHECK(web_contents);
+ // CreateForWebContents does nothing if the delegate instance already exists.
+ PaymentRequestWebContentsManager::CreateForWebContents(web_contents);
+ return PaymentRequestWebContentsManager::FromWebContents(web_contents);
+}
+
+void PaymentRequestWebContentsManager::CreatePaymentRequest(
+ content::WebContents* web_contents,
+ std::unique_ptr<PaymentRequestDelegate> delegate,
+ mojo::InterfaceRequest<payments::mojom::PaymentRequest> request) {
+ std::unique_ptr<PaymentRequest> new_request(new PaymentRequest(
+ web_contents, std::move(delegate), this, std::move(request)));
+ PaymentRequest* request_ptr = new_request.get();
+ payment_requests_.insert(std::make_pair(request_ptr, std::move(new_request)));
+}
+
+void PaymentRequestWebContentsManager::DestroyRequest(PaymentRequest* request) {
+ payment_requests_.erase(request);
+}
+
+PaymentRequestWebContentsManager::PaymentRequestWebContentsManager(
+ content::WebContents* web_contents) {}
+
+} // namespace payments
« no previous file with comments | « components/payments/payment_request_web_contents_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698