blob: cbd0e246ab9d79a501faffb3ef718c34844a093b [file] [log] [blame]
krb7f6421b2016-11-18 17:46:211// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
mathpf709499d2017-01-09 20:48:365#ifndef COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
6#define COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_
7
8#include <memory>
krb7f6421b2016-11-18 17:46:219
10#include "components/payments/payment_request.mojom.h"
11#include "mojo/public/cpp/bindings/binding.h"
12
13namespace content {
14class WebContents;
15}
16
17namespace payments {
18
mathpf709499d2017-01-09 20:48:3619class PaymentRequestDelegate;
20class PaymentRequestWebContentsManager;
21
22class PaymentRequest : payments::mojom::PaymentRequest {
krb7f6421b2016-11-18 17:46:2123 public:
mathpf709499d2017-01-09 20:48:3624 PaymentRequest(
krb7f6421b2016-11-18 17:46:2125 content::WebContents* web_contents,
mathpf709499d2017-01-09 20:48:3626 std::unique_ptr<PaymentRequestDelegate> delegate,
27 PaymentRequestWebContentsManager* manager,
krb7f6421b2016-11-18 17:46:2128 mojo::InterfaceRequest<payments::mojom::PaymentRequest> request);
mathpf709499d2017-01-09 20:48:3629 ~PaymentRequest() override;
krb7f6421b2016-11-18 17:46:2130
31 // payments::mojom::PaymentRequest "stub"
32 void Init(payments::mojom::PaymentRequestClientPtr client,
33 std::vector<payments::mojom::PaymentMethodDataPtr> methodData,
34 payments::mojom::PaymentDetailsPtr details,
35 payments::mojom::PaymentOptionsPtr options) override;
sanjoy.pala1f17e82016-12-15 03:39:1236 void Show() override;
krb7f6421b2016-11-18 17:46:2137 void UpdateWith(payments::mojom::PaymentDetailsPtr details) override {}
38 void Abort() override {}
39 void Complete(payments::mojom::PaymentComplete result) override {}
rob.buise3da0af2016-12-02 23:36:5740 void CanMakePayment() override {}
krb7f6421b2016-11-18 17:46:2141
anthonyvd3d7f9722016-12-07 18:43:5442 void Cancel();
krb7f6421b2016-11-18 17:46:2143 void OnError();
anthonyvddd172712017-01-06 15:21:2444 payments::mojom::PaymentDetails* details() { return details_.get(); }
krb7f6421b2016-11-18 17:46:2145
anthonyvd3d7f9722016-12-07 18:43:5446 content::WebContents* web_contents() { return web_contents_; }
47
krb7f6421b2016-11-18 17:46:2148 private:
krb7f6421b2016-11-18 17:46:2149 content::WebContents* web_contents_;
mathpf709499d2017-01-09 20:48:3650 std::unique_ptr<PaymentRequestDelegate> delegate_;
51 // |manager_| owns this PaymentRequest.
52 PaymentRequestWebContentsManager* manager_;
krb7f6421b2016-11-18 17:46:2153 mojo::Binding<payments::mojom::PaymentRequest> binding_;
anthonyvd3d7f9722016-12-07 18:43:5454 payments::mojom::PaymentRequestClientPtr client_;
anthonyvddd172712017-01-06 15:21:2455 payments::mojom::PaymentDetailsPtr details_;
anthonyvd3d7f9722016-12-07 18:43:5456
mathpf709499d2017-01-09 20:48:3657 DISALLOW_COPY_AND_ASSIGN(PaymentRequest);
krb7f6421b2016-11-18 17:46:2158};
59
60} // namespace payments
61
mathpf709499d2017-01-09 20:48:3662#endif // COMPONENTS_PAYMENTS_PAYMENT_REQUEST_H_