| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.h" | 5 #include "chrome/browser/ui/android/autofill/card_unmask_prompt_view_android.h" |
| 6 | 6 |
| 7 #include "chrome/browser/android/resource_mapper.h" |
| 7 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" | 8 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" |
| 8 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
| 9 #include "jni/CardUnmaskBridge_jni.h" | 10 #include "jni/CardUnmaskBridge_jni.h" |
| 10 #include "ui/base/android/view_android.h" | 11 #include "ui/base/android/view_android.h" |
| 11 #include "ui/base/android/window_android.h" | 12 #include "ui/base/android/window_android.h" |
| 12 | 13 |
| 13 namespace autofill { | 14 namespace autofill { |
| 14 | 15 |
| 15 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( | 16 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( |
| 16 CardUnmaskPromptController* controller) { | 17 CardUnmaskPromptController* controller) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 controller_->GetWebContents()->GetNativeView(); | 37 controller_->GetWebContents()->GetNativeView(); |
| 37 | 38 |
| 38 ScopedJavaLocalRef<jstring> dialog_title = | 39 ScopedJavaLocalRef<jstring> dialog_title = |
| 39 base::android::ConvertUTF16ToJavaString(env, | 40 base::android::ConvertUTF16ToJavaString(env, |
| 40 controller_->GetWindowTitle()); | 41 controller_->GetWindowTitle()); |
| 41 ScopedJavaLocalRef<jstring> instructions = | 42 ScopedJavaLocalRef<jstring> instructions = |
| 42 base::android::ConvertUTF16ToJavaString( | 43 base::android::ConvertUTF16ToJavaString( |
| 43 env, controller_->GetInstructionsMessage()); | 44 env, controller_->GetInstructionsMessage()); |
| 44 java_object_.Reset(Java_CardUnmaskBridge_create( | 45 java_object_.Reset(Java_CardUnmaskBridge_create( |
| 45 env, reinterpret_cast<intptr_t>(this), dialog_title.obj(), | 46 env, reinterpret_cast<intptr_t>(this), dialog_title.obj(), |
| 46 instructions.obj(), controller_->ShouldRequestExpirationDate(), | 47 instructions.obj(), |
| 48 ResourceMapper::MapFromChromiumId(controller_->GetCvcImageRid()), |
| 49 controller_->ShouldRequestExpirationDate(), |
| 47 view_android->GetWindowAndroid()->GetJavaObject().obj())); | 50 view_android->GetWindowAndroid()->GetJavaObject().obj())); |
| 48 | 51 |
| 49 Java_CardUnmaskBridge_show(env, java_object_.obj()); | 52 Java_CardUnmaskBridge_show(env, java_object_.obj()); |
| 50 } | 53 } |
| 51 | 54 |
| 52 bool CardUnmaskPromptViewAndroid::CheckUserInputValidity(JNIEnv* env, | 55 bool CardUnmaskPromptViewAndroid::CheckUserInputValidity(JNIEnv* env, |
| 53 jobject obj, | 56 jobject obj, |
| 54 jstring response) { | 57 jstring response) { |
| 55 return controller_->InputTextIsValid( | 58 return controller_->InputTextIsValid( |
| 56 base::android::ConvertJavaStringToUTF16(env, response)); | 59 base::android::ConvertJavaStringToUTF16(env, response)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 86 JNIEnv* env = base::android::AttachCurrentThread(); | 89 JNIEnv* env = base::android::AttachCurrentThread(); |
| 87 Java_CardUnmaskBridge_verificationFinished(env, java_object_.obj(), success); | 90 Java_CardUnmaskBridge_verificationFinished(env, java_object_.obj(), success); |
| 88 } | 91 } |
| 89 | 92 |
| 90 // static | 93 // static |
| 91 bool CardUnmaskPromptViewAndroid::Register(JNIEnv* env) { | 94 bool CardUnmaskPromptViewAndroid::Register(JNIEnv* env) { |
| 92 return RegisterNativesImpl(env); | 95 return RegisterNativesImpl(env); |
| 93 } | 96 } |
| 94 | 97 |
| 95 } // namespace autofill | 98 } // namespace autofill |
| OLD | NEW |