| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 package org.chromium.chrome.browser.payments; | 5 package org.chromium.chrome.browser.payments; |
| 6 | 6 |
| 7 import android.os.AsyncTask; | 7 import android.os.AsyncTask; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.text.SpannableStringBuilder; | 9 import android.text.SpannableStringBuilder; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 descriptions.add(mAcceptedCardTypeInfos.get(i).description); | 462 descriptions.add(mAcceptedCardTypeInfos.get(i).description); |
| 463 } | 463 } |
| 464 mIconHint = EditorFieldModel.createIconList( | 464 mIconHint = EditorFieldModel.createIconList( |
| 465 mContext.getString(R.string.payments_accepted_cards_label),
icons, | 465 mContext.getString(R.string.payments_accepted_cards_label),
icons, |
| 466 descriptions); | 466 descriptions); |
| 467 } | 467 } |
| 468 editor.addField(mIconHint); | 468 editor.addField(mIconHint); |
| 469 | 469 |
| 470 // Card scanner is expensive to query. | 470 // Card scanner is expensive to query. |
| 471 if (mCardScanner == null) { | 471 if (mCardScanner == null) { |
| 472 mCardScanner = CreditCardScanner.create(mWebContents, this); | 472 mCardScanner = CreditCardScanner.create(mContext, mWebContents, this
); |
| 473 mCanScan = mCardScanner.canScan(); | 473 mCanScan = mCardScanner.canScan(); |
| 474 } | 474 } |
| 475 | 475 |
| 476 // Card number is validated. | 476 // Card number is validated. |
| 477 if (mNumberField == null) { | 477 if (mNumberField == null) { |
| 478 mNumberField = EditorFieldModel.createTextInput( | 478 mNumberField = EditorFieldModel.createTextInput( |
| 479 EditorFieldModel.INPUT_TYPE_HINT_CREDIT_CARD, | 479 EditorFieldModel.INPUT_TYPE_HINT_CREDIT_CARD, |
| 480 mContext.getString(R.string.autofill_credit_card_editor_numb
er), null, | 480 mContext.getString(R.string.autofill_credit_card_editor_numb
er), null, |
| 481 mCardNumberValidator, mCardIconGenerator, | 481 mCardNumberValidator, mCardIconGenerator, |
| 482 mContext.getString(R.string.payments_field_required_validati
on_message), | 482 mContext.getString(R.string.payments_field_required_validati
on_message), |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 819 | 819 |
| 820 mEditorView.update(); | 820 mEditorView.update(); |
| 821 mIsScanning = false; | 821 mIsScanning = false; |
| 822 } | 822 } |
| 823 | 823 |
| 824 @Override | 824 @Override |
| 825 public void onScanCancelled() { | 825 public void onScanCancelled() { |
| 826 mIsScanning = false; | 826 mIsScanning = false; |
| 827 } | 827 } |
| 828 } | 828 } |
| OLD | NEW |