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

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

Issue 2732913004: Post fix of CL "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; 883 size_t limit = SIZE_MAX;
884 // Reassign SIZE_MAX to |limit| is needed after calling base::StringToSizeT,
885 // as this method can modify |limit| even if it returns false.
884 if (!base::StringToSizeT(limit_str, &limit)) 886 if (!base::StringToSizeT(limit_str, &limit))
885 limit = SIZE_MAX; 887 limit = SIZE_MAX;
886 888
887 unique_suggestions.resize(std::min(unique_suggestions.size(), limit)); 889 unique_suggestions.resize(std::min(unique_suggestions.size(), limit));
888 890
889 return unique_suggestions; 891 return unique_suggestions;
890 } 892 }
891 893
892 // TODO(crbug.com/613187): Investigate if it would be more efficient to dedupe 894 // TODO(crbug.com/613187): Investigate if it would be more efficient to dedupe
893 // with a vector instead of a list. 895 // with a vector instead of a list.
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1941 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email); 1943 existing_profiles->back().SetRawInfo(EMAIL_ADDRESS, email);
1942 1944
1943 AutofillMetrics::LogWalletAddressConversionType( 1945 AutofillMetrics::LogWalletAddressConversionType(
1944 AutofillMetrics::CONVERTED_ADDRESS_ADDED); 1946 AutofillMetrics::CONVERTED_ADDRESS_ADDED);
1945 } 1947 }
1946 1948
1947 return guid; 1949 return guid;
1948 } 1950 }
1949 1951
1950 } // namespace autofill 1952 } // 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