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

Side by Side 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 post-merge 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 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
5 #include "chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.h"
6
7 #include "content/public/browser/web_contents.h"
8 #include "jni/CardUnmaskBridge_jni.h"
9 #include "ui/base/android/view_android.h"
10 #include "ui/base/android/window_android.h"
11
12 namespace autofill {
13
14 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow(
15 content::WebContents* web_contents,
16 const UnmaskCallback& finished) {
17 CardUnmaskPromptViewAndroid* view =
18 new CardUnmaskPromptViewAndroid(web_contents, finished);
19 view->Show();
20 return view;
21 }
22
23 CardUnmaskPromptViewAndroid::CardUnmaskPromptViewAndroid(
24 content::WebContents* web_contents,
25 const UnmaskCallback& finished)
26 : web_contents_(web_contents), finished_(finished) {
27 }
28
29 CardUnmaskPromptViewAndroid::~CardUnmaskPromptViewAndroid() {
30 finished_.Run(response_);
31 }
32
33 void CardUnmaskPromptViewAndroid::Show() {
34 JNIEnv* env = base::android::AttachCurrentThread();
35 ui::ViewAndroid* view_android = web_contents_->GetNativeView();
36
37 java_object_.Reset(Java_CardUnmaskBridge_create(
38 env, reinterpret_cast<intptr_t>(this),
39 view_android->GetWindowAndroid()->GetJavaObject().obj()));
40
41 Java_CardUnmaskBridge_show(env, java_object_.obj());
42 }
43
44 void CardUnmaskPromptViewAndroid::PromptDismissed(JNIEnv* env,
45 jobject obj,
46 jstring response) {
47 response_ = base::android::ConvertJavaStringToUTF16(env, response);
48 delete this;
49 }
50
51 // static
52 bool CardUnmaskPromptViewAndroid::Register(JNIEnv* env) {
53 return RegisterNativesImpl(env);
54 }
55
56 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698