| 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 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ |
| 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ |
| 7 | 7 |
| 8 #include <unordered_map> | 8 #include <unordered_map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // A non-negative number indicating how sure the type is for this specific | 22 // A non-negative number indicating how sure the type is for this specific |
| 23 // candidate. The higher the more confidence. | 23 // candidate. The higher the more confidence. |
| 24 float score = 0.0f; | 24 float score = 0.0f; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 // Each field can be of different types. This class collects all these possible | 27 // Each field can be of different types. This class collects all these possible |
| 28 // types and determines which type is the most likely. | 28 // types and determines which type is the most likely. |
| 29 class FieldCandidates { | 29 class FieldCandidates { |
| 30 public: | 30 public: |
| 31 FieldCandidates(); | 31 FieldCandidates(); |
| 32 FieldCandidates(const FieldCandidates& other); |
| 32 ~FieldCandidates(); | 33 ~FieldCandidates(); |
| 33 | 34 |
| 34 // Includes a possible |type| for a given field. | 35 // Includes a possible |type| for a given field. |
| 35 // | 36 // |
| 36 // Callers are responsible for the scores they add. FieldCandidates is | 37 // Callers are responsible for the scores they add. FieldCandidates is |
| 37 // agnostic to the source of these scores and will select the best candidate | 38 // agnostic to the source of these scores and will select the best candidate |
| 38 // based solely on their numeric values. BestHeuristicType() uses |score| to | 39 // based solely on their numeric values. BestHeuristicType() uses |score| to |
| 39 // determine the most likely type for this given field. Please see | 40 // determine the most likely type for this given field. Please see |
| 40 // field_candidates.cc for details on how this type is actually chosen. | 41 // field_candidates.cc for details on how this type is actually chosen. |
| 41 void AddFieldCandidate(ServerFieldType type, float score); | 42 void AddFieldCandidate(ServerFieldType type, float score); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 52 // Internal storage for all the possible types for a given field. | 53 // Internal storage for all the possible types for a given field. |
| 53 std::vector<FieldCandidate> field_candidates_; | 54 std::vector<FieldCandidate> field_candidates_; |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 // A map from the field's unique name to its possible candidates. | 57 // A map from the field's unique name to its possible candidates. |
| 57 using FieldCandidatesMap = std::unordered_map<base::string16, FieldCandidates>; | 58 using FieldCandidatesMap = std::unordered_map<base::string16, FieldCandidates>; |
| 58 | 59 |
| 59 } // namespace autofill | 60 } // namespace autofill |
| 60 | 61 |
| 61 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ | 62 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_FIELD_CANDIDATES_H_ |
| OLD | NEW |