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

Unified Diff: components/payments/core/payment_instrument.h

Issue 2733953003: [Payments] Return a basic card response (Closed)
Patch Set: tests Created 3 years, 9 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
Index: components/payments/core/payment_instrument.h
diff --git a/components/payments/core/payment_instrument.h b/components/payments/core/payment_instrument.h
new file mode 100644
index 0000000000000000000000000000000000000000..98f92321ff21932221b53ee807fb94ae0db05a15
--- /dev/null
+++ b/components/payments/core/payment_instrument.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_
+#define COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_
+
+#include <set>
+#include <string>
+
+#include "base/macros.h"
+
+namespace payments {
+
+// Base class which represents a form of payment in Payment Request.
+class PaymentInstrument {
+ public:
+ class Delegate {
+ public:
please use gerrit instead 2017/03/08 14:46:10 Need an empty virtual destrutor.
Mathieu 2017/03/08 18:04:26 Done.
+ // Should be called with method name (e.g. "visa"), and json-serialized
please use gerrit instead 2017/03/08 14:46:10 Remove comma before "and". Add comma after "e.g.".
Mathieu 2017/03/08 18:04:26 Done.
+ // stringified details.
+ virtual void OnInstrumentDetailsReady(
+ const std::string& method_name,
+ const std::string& stringified_details) = 0;
+
+ virtual void OnInstrumentDetailsError() = 0;
+ };
+
+ virtual ~PaymentInstrument() {}
+
+ // Will call into the |delegate| (can't be null) on success or error.
+ virtual void InvokePaymentApp(Delegate* delegate) = 0;
+
+ const std::string& method_name() { return method_name_; }
+
+ protected:
+ explicit PaymentInstrument(const std::string& method_name)
+ : method_name_(method_name) {}
+
+ private:
+ const std::string method_name_;
+
+ DISALLOW_COPY_AND_ASSIGN(PaymentInstrument);
+};
+
+} // namespace payments
+
+#endif // COMPONENTS_PAYMENTS_CORE_PAYMENT_INSTRUMENT_H_

Powered by Google App Engine
This is Rietveld 408576698