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/field_candidates.h" | 5 #include "components/autofill/core/browser/field_candidates.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 | 11 |
12 namespace autofill { | 12 namespace autofill { |
13 | 13 |
14 FieldCandidate::FieldCandidate(ServerFieldType field_type, float field_score) | 14 FieldCandidate::FieldCandidate(ServerFieldType field_type, float field_score) |
15 : type(field_type), score(field_score) {} | 15 : type(field_type), score(field_score) {} |
16 | 16 |
17 FieldCandidates::FieldCandidates() {} | 17 FieldCandidates::FieldCandidates() {} |
18 | 18 |
| 19 FieldCandidates::FieldCandidates(const FieldCandidates& other) = default; |
| 20 |
19 FieldCandidates::~FieldCandidates() {} | 21 FieldCandidates::~FieldCandidates() {} |
20 | 22 |
21 void FieldCandidates::AddFieldCandidate(ServerFieldType type, float score) { | 23 void FieldCandidates::AddFieldCandidate(ServerFieldType type, float score) { |
22 field_candidates_.emplace_back(type, score); | 24 field_candidates_.emplace_back(type, score); |
23 } | 25 } |
24 | 26 |
25 // We currently select the type with the biggest sum. | 27 // We currently select the type with the biggest sum. |
26 ServerFieldType FieldCandidates::BestHeuristicType() const { | 28 ServerFieldType FieldCandidates::BestHeuristicType() const { |
27 if (field_candidates_.empty()) | 29 if (field_candidates_.empty()) |
28 return UNKNOWN_TYPE; | 30 return UNKNOWN_TYPE; |
(...skipping 12 matching lines...) Expand all Loading... |
41 const size_t index = std::distance(type_scores.begin(), best_type_iter); | 43 const size_t index = std::distance(type_scores.begin(), best_type_iter); |
42 | 44 |
43 return static_cast<ServerFieldType>(index); | 45 return static_cast<ServerFieldType>(index); |
44 } | 46 } |
45 | 47 |
46 const std::vector<FieldCandidate>& FieldCandidates::field_candidates() const { | 48 const std::vector<FieldCandidate>& FieldCandidates::field_candidates() const { |
47 return field_candidates_; | 49 return field_candidates_; |
48 } | 50 } |
49 | 51 |
50 } // namespace autofill | 52 } // namespace autofill |
OLD | NEW |