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

Unified Diff: chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.cc

Issue 756333003: Prompt for unmasking Wallet credit card on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile and docs Created 6 years 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/browser/ui/android/autofill/card_unmask_prompt_view_android.cc
diff --git a/chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.cc b/chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7177cfd50525b1a5ac969c2f3d03d85bd713cbbd
--- /dev/null
+++ b/chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.cc
@@ -0,0 +1,56 @@
+// 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.
+
+#include "chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.h"
+
+#include "content/public/browser/web_contents.h"
+#include "jni/CardUnmaskBridge_jni.h"
+#include "ui/base/android/view_android.h"
+#include "ui/base/android/window_android.h"
+
+namespace autofill {
+
+CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow(
+ content::WebContents* web_contents,
+ const UnmaskCallback& finished) {
+ CardUnmaskPromptViewAndroid* view =
+ new CardUnmaskPromptViewAndroid(web_contents, finished);
+ view->Show();
+ return view;
+}
+
+CardUnmaskPromptViewAndroid::CardUnmaskPromptViewAndroid(
+ content::WebContents* web_contents,
+ const UnmaskCallback& finished)
+ : web_contents_(web_contents), finished_(finished) {
+}
+
+CardUnmaskPromptViewAndroid::~CardUnmaskPromptViewAndroid() {
+ finished_.Run(response_);
+}
+
+void CardUnmaskPromptViewAndroid::Show() {
+ JNIEnv* env = base::android::AttachCurrentThread();
+ ui::ViewAndroid* view_android = web_contents_->GetNativeView();
+
+ java_object_.Reset(Java_CardUnmaskBridge_create(
+ env, reinterpret_cast<intptr_t>(this),
+ view_android->GetWindowAndroid()->GetJavaObject().obj()));
+
+ Java_CardUnmaskBridge_show(env, java_object_.obj());
+}
+
+void CardUnmaskPromptViewAndroid::PromptDismissed(JNIEnv* env,
+ jobject obj,
+ jstring response) {
+ response_ = base::android::ConvertJavaStringToUTF16(env, response);
+ delete this;
+}
+
+// static
+bool CardUnmaskPromptViewAndroid::Register(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
+} // namespace autofill

Powered by Google App Engine
This is Rietveld 408576698