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

Side by Side Diff: chrome/browser/ui/android/autofill/credit_card_scanner_view_android.cc

Issue 2257493004: Add "AutofillScanCardholderName" feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Disable feature by default Created 4 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_experiments.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/credit_card_scanner_view_android.h" 5 #include "chrome/browser/ui/android/autofill/credit_card_scanner_view_android.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/android/context_utils.h" 9 #include "base/android/context_utils.h"
10 #include "base/android/jni_android.h" 10 #include "base/android/jni_android.h"
11 #include "base/android/jni_string.h" 11 #include "base/android/jni_string.h"
12 #include "base/feature_list.h"
12 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
13 #include "chrome/browser/ui/android/view_android_helper.h" 14 #include "chrome/browser/ui/android/view_android_helper.h"
14 #include "chrome/browser/ui/autofill/credit_card_scanner_view_delegate.h" 15 #include "chrome/browser/ui/autofill/credit_card_scanner_view_delegate.h"
16 #include "components/autofill/core/browser/autofill_experiments.h"
15 #include "components/autofill/core/browser/credit_card.h" 17 #include "components/autofill/core/browser/credit_card.h"
16 #include "components/autofill/core/browser/field_types.h" 18 #include "components/autofill/core/browser/field_types.h"
17 #include "content/public/browser/android/content_view_core.h" 19 #include "content/public/browser/android/content_view_core.h"
18 #include "jni/CreditCardScanner_jni.h" 20 #include "jni/CreditCardScanner_jni.h"
19 #include "ui/android/view_android.h" 21 #include "ui/android/view_android.h"
20 #include "ui/android/window_android.h" 22 #include "ui/android/window_android.h"
21 23
22 using base::android::JavaParamRef; 24 using base::android::JavaParamRef;
23 25
24 namespace autofill { 26 namespace autofill {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 70
69 void CreditCardScannerViewAndroid::ScanCompleted( 71 void CreditCardScannerViewAndroid::ScanCompleted(
70 JNIEnv* env, 72 JNIEnv* env,
71 const JavaParamRef<jobject>& object, 73 const JavaParamRef<jobject>& object,
72 const JavaParamRef<jstring>& card_holder_name, 74 const JavaParamRef<jstring>& card_holder_name,
73 const JavaParamRef<jstring>& card_number, 75 const JavaParamRef<jstring>& card_number,
74 jint expiration_month, 76 jint expiration_month,
75 jint expiration_year) { 77 jint expiration_year) {
76 CreditCard card(base::android::ConvertJavaStringToUTF16(env, card_number), 78 CreditCard card(base::android::ConvertJavaStringToUTF16(env, card_number),
77 static_cast<int>(expiration_month), static_cast<int>(expiration_year)); 79 static_cast<int>(expiration_month), static_cast<int>(expiration_year));
78 card.SetRawInfo(CREDIT_CARD_NAME_FULL, 80
79 base::android::ConvertJavaStringToUTF16(env, card_holder_name)); 81 if (base::FeatureList::IsEnabled(kAutofillScanCardholderName)) {
82 card.SetRawInfo(CREDIT_CARD_NAME_FULL,
83 base::android::ConvertJavaStringToUTF16(env, card_holder_name));
84 }
85
80 delegate_->ScanCompleted(card); 86 delegate_->ScanCompleted(card);
81 } 87 }
82 88
83 void CreditCardScannerViewAndroid::Show() { 89 void CreditCardScannerViewAndroid::Show() {
84 JNIEnv* env = base::android::AttachCurrentThread(); 90 JNIEnv* env = base::android::AttachCurrentThread();
85 Java_CreditCardScanner_scan(env, java_object_); 91 Java_CreditCardScanner_scan(env, java_object_);
86 } 92 }
87 93
88 } // namespace autofill 94 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/autofill_experiments.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698