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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/EditorBase.java

Issue 2093363002: Autofill address editor in PaymentRequest UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@contact-editor
Patch Set: Fix try-bot Created 4 years, 6 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: chrome/android/java/src/org/chromium/chrome/browser/payments/EditorBase.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/EditorBase.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/EditorBase.java
new file mode 100644
index 0000000000000000000000000000000000000000..868aff044b1da1e5f6423145657486fd775d685e
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/EditorBase.java
@@ -0,0 +1,46 @@
+// Copyright 2016 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.
+
+package org.chromium.chrome.browser.payments;
+
+import android.content.Context;
+
+import org.chromium.base.Callback;
+import org.chromium.chrome.browser.payments.ui.EditorView;
+import org.chromium.chrome.browser.payments.ui.PaymentOption;
+
+import javax.annotation.Nullable;
+
+/**
+ * The base class for an editor controller.
+ */
+abstract class EditorBase<T extends PaymentOption> {
+ @Nullable protected EditorView mEditorView;
+ @Nullable protected Context mContext;
+
+ /**
+ * Sets the user interface to be used for editing contact information.
+ *
+ * @param editorView The user interface to be used.
+ */
+ public void setEditorView(EditorView editorView) {
+ assert editorView != null;
+ mEditorView = editorView;
+ mContext = mEditorView.getContext();
+ }
+
+ /**
+ * Shows the user interface for editing the given information.
+ *
+ * @param toEdit The information to edit. Can be null if the user is adding new information
+ * instead of editing an existing one.
+ * @param callback The callback to invoke with the complete and valid information. Can be
+ * invoked with null if the user clicked Cancel.
+ */
+ protected void edit(@Nullable T toEdit, Callback<T> callback) {
+ assert callback != null;
+ assert mEditorView != null;
+ assert mContext != null;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698