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