Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(733)

Side by Side Diff: components/autofill/core/browser/autofill_data_util.cc

Issue 2417783004: Replace for loops with |arraysize| with for each loops (Closed)
Patch Set: Adressed Comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (size_t i = 0; i < arraysize(kPaymentRequestData); ++i) { 403 for (const PaymentRequestData& data : kPaymentRequestData) {
404 if (type == kPaymentRequestData[i].card_type) 404 if (type == data.card_type)
405 return kPaymentRequestData[i]; 405 return data;
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 (size_t i = 0; i < arraysize(kPaymentRequestData); ++i) { 412 for (const PaymentRequestData& data : kPaymentRequestData) {
413 if (basic_card_payment_type == 413 if (basic_card_payment_type == data.basic_card_payment_type) {
414 kPaymentRequestData[i].basic_card_payment_type) { 414 return data.card_type;
415 return kPaymentRequestData[i].card_type;
416 } 415 }
417 } 416 }
418 return kGenericPaymentRequestData.card_type; 417 return kGenericPaymentRequestData.card_type;
419 } 418 }
420 419
421 } // namespace data_util 420 } // namespace data_util
422 } // namespace autofill 421 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698