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

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

Issue 2724153004: Declare a variable before using it (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/personal_data_manager.h" 5 #include "components/autofill/core/browser/personal_data_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 unique_matched_profiles, &other_field_types, type.GetStorableType(), 1, 873 unique_matched_profiles, &other_field_types, type.GetStorableType(), 1,
874 app_locale_, &labels); 874 app_locale_, &labels);
875 DCHECK_EQ(unique_suggestions.size(), labels.size()); 875 DCHECK_EQ(unique_suggestions.size(), labels.size());
876 for (size_t i = 0; i < labels.size(); i++) 876 for (size_t i = 0; i < labels.size(); i++)
877 unique_suggestions[i].label = labels[i]; 877 unique_suggestions[i].label = labels[i];
878 878
879 // Get the profile suggestions limit value set for the current frecency field 879 // Get the profile suggestions limit value set for the current frecency field
880 // trial group or SIZE_MAX if no limit is defined. 880 // trial group or SIZE_MAX if no limit is defined.
881 std::string limit_str = variations::GetVariationParamValue( 881 std::string limit_str = variations::GetVariationParamValue(
882 kFrecencyFieldTrialName, kFrecencyFieldTrialLimitParam); 882 kFrecencyFieldTrialName, kFrecencyFieldTrialLimitParam);
883 size_t limit = base::StringToSizeT(limit_str, &limit) ? limit : SIZE_MAX; 883 size_t limit;
vabr (Chromium) 2017/03/04 19:40:29 This is actually worse than before. Before there w
chengx 2017/03/06 18:26:14 I will use another CL to fix this. Thanks!
vabr (Chromium) 2017/03/06 18:46:48 SGTM, thanks for following up! :)
884 if (!base::StringToSizeT(limit_str, &limit))
885 limit = SIZE_MAX;
884 886
885 unique_suggestions.resize(std::min(unique_suggestions.size(), limit)); 887 unique_suggestions.resize(std::min(unique_suggestions.size(), limit));
886 888
887 return unique_suggestions; 889 return unique_suggestions;
888 } 890 }
889 891
890 // TODO(crbug.com/613187): Investigate if it would be more efficient to dedupe 892 // TODO(crbug.com/613187): Investigate if it would be more efficient to dedupe
891 // with a vector instead of a list. 893 // with a vector instead of a list.
892 const std::vector<CreditCard*> PersonalDataManager::GetCreditCardsToSuggest() 894 const std::vector<CreditCard*> PersonalDataManager::GetCreditCardsToSuggest()
893 const { 895 const {
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after
1939 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email); 1941 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email);
1940 1942
1941 AutofillMetrics::LogWalletAddressConversionType( 1943 AutofillMetrics::LogWalletAddressConversionType(
1942 AutofillMetrics::CONVERTED_ADDRESS_ADDED); 1944 AutofillMetrics::CONVERTED_ADDRESS_ADDED);
1943 } 1945 }
1944 1946
1945 return guid; 1947 return guid;
1946 } 1948 }
1947 1949
1948 } // namespace autofill 1950 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698