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 #include "components/autofill/core/browser/autofill_data_util.h" | 5 #include "components/autofill/core/browser/autofill_data_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 candidate = profile.GetRawInfo(autofill::NAME_LAST) + | 393 candidate = profile.GetRawInfo(autofill::NAME_LAST) + |
394 profile.GetRawInfo(autofill::NAME_FIRST); | 394 profile.GetRawInfo(autofill::NAME_FIRST); |
395 if (!full_name.compare(candidate)) { | 395 if (!full_name.compare(candidate)) { |
396 return true; | 396 return true; |
397 } | 397 } |
398 | 398 |
399 return false; | 399 return false; |
400 } | 400 } |
401 | 401 |
402 const PaymentRequestData& GetPaymentRequestData(const std::string& type) { | 402 const PaymentRequestData& GetPaymentRequestData(const std::string& type) { |
403 for (const PaymentRequestData& data : kPaymentRequestData) { | 403 for (size_t i = 0; i < arraysize(kPaymentRequestData); ++i) { |
404 if (type == data.card_type) | 404 if (type == kPaymentRequestData[i].card_type) |
405 return data; | 405 return kPaymentRequestData[i]; |
406 } | 406 } |
407 return kGenericPaymentRequestData; | 407 return kGenericPaymentRequestData; |
408 } | 408 } |
409 | 409 |
410 const char* GetCardTypeForBasicCardPaymentType( | 410 const char* GetCardTypeForBasicCardPaymentType( |
411 const std::string& basic_card_payment_type) { | 411 const std::string& basic_card_payment_type) { |
412 for (const PaymentRequestData& data : kPaymentRequestData) { | 412 for (size_t i = 0; i < arraysize(kPaymentRequestData); ++i) { |
413 if (basic_card_payment_type == data.basic_card_payment_type) { | 413 if (basic_card_payment_type == |
414 return data.card_type; | 414 kPaymentRequestData[i].basic_card_payment_type) { |
| 415 return kPaymentRequestData[i].card_type; |
415 } | 416 } |
416 } | 417 } |
417 return kGenericPaymentRequestData.card_type; | 418 return kGenericPaymentRequestData.card_type; |
418 } | 419 } |
419 | 420 |
420 } // namespace data_util | 421 } // namespace data_util |
421 } // namespace autofill | 422 } // namespace autofill |
OLD | NEW |