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.TextUtils; | 9 import android.text.TextUtils; |
10 import android.util.Pair; | 10 import android.util.Pair; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 @Override | 254 @Override |
255 public void edit(@Nullable final AutofillPaymentInstrument toEdit, | 255 public void edit(@Nullable final AutofillPaymentInstrument toEdit, |
256 final Callback<AutofillPaymentInstrument> callback) { | 256 final Callback<AutofillPaymentInstrument> callback) { |
257 super.edit(toEdit, callback); | 257 super.edit(toEdit, callback); |
258 | 258 |
259 // If |toEdit| is null, we're creating a new credit card. | 259 // If |toEdit| is null, we're creating a new credit card. |
260 final boolean isNewCard = toEdit == null; | 260 final boolean isNewCard = toEdit == null; |
261 | 261 |
262 // Ensure that |instrument| and |card| are never null. | 262 // Ensure that |instrument| and |card| are never null. |
263 final AutofillPaymentInstrument instrument = isNewCard | 263 final AutofillPaymentInstrument instrument = isNewCard |
264 ? new AutofillPaymentInstrument(mWebContents, new CreditCard(),
null) | 264 ? new AutofillPaymentInstrument(mContext, mWebContents, new Cred
itCard(), null) |
265 : toEdit; | 265 : toEdit; |
266 final CreditCard card = instrument.getCard(); | 266 final CreditCard card = instrument.getCard(); |
267 | 267 |
268 // The title of the editor depends on whether we're adding a new card or
editing an existing | 268 // The title of the editor depends on whether we're adding a new card or
editing an existing |
269 // card. | 269 // card. |
270 final EditorModel editor = new EditorModel(mContext.getString(isNewCard | 270 final EditorModel editor = new EditorModel(mContext.getString(isNewCard |
271 ? R.string.autofill_create_credit_card | 271 ? R.string.autofill_create_credit_card |
272 : R.string.autofill_edit_credit_card)); | 272 : R.string.autofill_edit_credit_card)); |
273 | 273 |
274 if (card.getIsLocal()) { | 274 if (card.getIsLocal()) { |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 605 |
606 mEditorView.update(); | 606 mEditorView.update(); |
607 mIsScanning = false; | 607 mIsScanning = false; |
608 } | 608 } |
609 | 609 |
610 @Override | 610 @Override |
611 public void onScanCancelled() { | 611 public void onScanCancelled() { |
612 mIsScanning = false; | 612 mIsScanning = false; |
613 } | 613 } |
614 } | 614 } |
OLD | NEW |