Index: ui/android/java/src/org/chromium/ui/autofill/InstrumentUnmaskPrompt.java |
diff --git a/ui/android/java/src/org/chromium/ui/autofill/InstrumentUnmaskPrompt.java b/ui/android/java/src/org/chromium/ui/autofill/InstrumentUnmaskPrompt.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..45da266d127317c79144746382d188c7e0ad58b0 |
--- /dev/null |
+++ b/ui/android/java/src/org/chromium/ui/autofill/InstrumentUnmaskPrompt.java |
@@ -0,0 +1,70 @@ |
+// Copyright 2014 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.ui.autofill; |
+ |
+import android.app.AlertDialog; |
+import android.content.Context; |
+import android.content.DialogInterface; |
+import android.view.LayoutInflater; |
+import android.view.View; |
+import android.widget.EditText; |
+ |
+import org.chromium.ui.R; |
+ |
+/** |
+ * A prompt that bugs users to enter their CVC when unmasking a Wallet instrument. |
+ */ |
+public class InstrumentUnmaskPrompt implements DialogInterface.OnClickListener, |
+ DialogInterface.OnDismissListener { |
+ private InstrumentUnmaskPromptDelegate mDelegate; |
+ private int mClickedButton; |
+ private AlertDialog mDialog; |
+ |
+ /** |
+ * An interface to handle the interaction with an InstrumentUnmaskPrompt object. |
+ */ |
+ public interface InstrumentUnmaskPromptDelegate { |
+ public void dismissed(String response); |
+ } |
+ |
+ public InstrumentUnmaskPrompt(Context context, InstrumentUnmaskPromptDelegate delegate) { |
+ mDelegate = delegate; |
+ mClickedButton = DialogInterface.BUTTON_NEGATIVE; |
+ |
+ LayoutInflater inflater = LayoutInflater.from(context); |
+ View v = inflater.inflate(R.layout.instrument_unmask_prompt, null); |
+ |
+ mDialog = new AlertDialog.Builder(context) |
+ .setTitle("Unlocking Visa - 1111") |
+ .setView(v) |
+ .setNegativeButton("Back", this) |
+ .setPositiveButton("Rock on", this) |
+ .setOnDismissListener(this).create(); |
+ } |
+ |
+ public void show() { |
+ mDialog.show(); |
+ } |
+ |
+ public void hide() { |
+ mDialog.hide(); |
+ } |
+ |
+ @Override |
+ public void onClick(DialogInterface dialog, int which) { |
+ mClickedButton = which; |
+ } |
+ |
+ @Override |
+ public void onDismiss(DialogInterface dialog) { |
+ if (mClickedButton == DialogInterface.BUTTON_POSITIVE) { |
+ String response = ((EditText) mDialog.findViewById(R.id.instrument_unmask_input)) |
+ .getText().toString(); |
+ mDelegate.dismissed(response); |
+ } else { |
+ mDelegate.dismissed(""); |
+ } |
+ } |
+} |