Chromium Code Reviews| 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.app.Activity; | 7 import android.app.Activity; |
| 8 import android.graphics.Bitmap; | 8 import android.graphics.Bitmap; |
| 9 import android.os.Handler; | 9 import android.os.Handler; |
| 10 import android.text.TextUtils; | 10 import android.text.TextUtils; |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 } | 558 } |
| 559 | 559 |
| 560 if (!formatter.isValidAmountValue(details.total.amount.value) | 560 if (!formatter.isValidAmountValue(details.total.amount.value) |
| 561 || details.total.amount.value.startsWith("-")) { | 561 || details.total.amount.value.startsWith("-")) { |
| 562 disconnectFromClientWithDebugMessage("Invalid total amount value"); | 562 disconnectFromClientWithDebugMessage("Invalid total amount value"); |
| 563 recordAbortReasonHistogram( | 563 recordAbortReasonHistogram( |
| 564 PaymentRequestMetrics.ABORT_REASON_INVALID_DATA_FROM_RENDERE R); | 564 PaymentRequestMetrics.ABORT_REASON_INVALID_DATA_FROM_RENDERE R); |
| 565 return false; | 565 return false; |
| 566 } | 566 } |
| 567 | 567 |
| 568 LineItem uiTotal = new LineItem( | 568 LineItem uiTotal = new LineItem( |
|
Mathieu
2016/10/26 02:04:59
nit: can you add a comment saying that the total i
please use gerrit instead
2016/10/26 13:48:16
Done.
| |
| 569 details.total.label, formatter.getFormattedCurrencyCode(), | 569 details.total.label, formatter.getFormattedCurrencyCode(), |
| 570 formatter.format(details.total.amount.value)); | 570 formatter.format(details.total.amount.value), false); |
| 571 | 571 |
| 572 List<LineItem> uiLineItems = getValidatedLineItems(details.displayItems, totalCurrency, | 572 List<LineItem> uiLineItems = getValidatedLineItems(details.displayItems, totalCurrency, |
| 573 formatter); | 573 formatter); |
| 574 if (uiLineItems == null) { | 574 if (uiLineItems == null) { |
| 575 disconnectFromClientWithDebugMessage("Invalid line items"); | 575 disconnectFromClientWithDebugMessage("Invalid line items"); |
| 576 recordAbortReasonHistogram( | 576 recordAbortReasonHistogram( |
| 577 PaymentRequestMetrics.ABORT_REASON_INVALID_DATA_FROM_RENDERE R); | 577 PaymentRequestMetrics.ABORT_REASON_INVALID_DATA_FROM_RENDERE R); |
| 578 return false; | 578 return false; |
| 579 } | 579 } |
| 580 | 580 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 625 PaymentItem item = items[i]; | 625 PaymentItem item = items[i]; |
| 626 | 626 |
| 627 if (!hasAllPaymentItemFields(item)) return null; | 627 if (!hasAllPaymentItemFields(item)) return null; |
| 628 | 628 |
| 629 // All currencies must match. | 629 // All currencies must match. |
| 630 if (!item.amount.currency.equals(totalCurrency)) return null; | 630 if (!item.amount.currency.equals(totalCurrency)) return null; |
| 631 | 631 |
| 632 // Value should be in correct format. | 632 // Value should be in correct format. |
| 633 if (!formatter.isValidAmountValue(item.amount.value)) return null; | 633 if (!formatter.isValidAmountValue(item.amount.value)) return null; |
| 634 | 634 |
| 635 result.add(new LineItem(item.label, "", formatter.format(item.amount .value))); | 635 result.add(new LineItem( |
| 636 item.label, "", formatter.format(item.amount.value), item.pe nding)); | |
| 636 } | 637 } |
| 637 | 638 |
| 638 return result; | 639 return result; |
| 639 } | 640 } |
| 640 | 641 |
| 641 /** | 642 /** |
| 642 * Validates a list of shipping options and returns their parsed representat ion or null if | 643 * Validates a list of shipping options and returns their parsed representat ion or null if |
| 643 * invalid. | 644 * invalid. |
| 644 * | 645 * |
| 645 * @param options The raw shipping options to parse and validate. | 646 * @param options The raw shipping options to parse and validate. |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1220 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, | 1221 "PaymentRequest.CheckoutFunnel.Aborted", abortReason, |
| 1221 PaymentRequestMetrics.ABORT_REASON_MAX); | 1222 PaymentRequestMetrics.ABORT_REASON_MAX); |
| 1222 | 1223 |
| 1223 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { | 1224 if (abortReason == PaymentRequestMetrics.ABORT_REASON_ABORTED_BY_USER) { |
| 1224 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); | 1225 mJourneyLogger.recordJourneyStatsHistograms("UserAborted"); |
| 1225 } else { | 1226 } else { |
| 1226 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); | 1227 mJourneyLogger.recordJourneyStatsHistograms("OtherAborted"); |
| 1227 } | 1228 } |
| 1228 } | 1229 } |
| 1229 } | 1230 } |
| OLD | NEW |