| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Similar to ClassifyMatchInString(), but for cases where the range to mark | 137 // Similar to ClassifyMatchInString(), but for cases where the range to mark |
| 138 // as matching is already known (avoids calling find()). This can be helpful | 138 // as matching is already known (avoids calling find()). This can be helpful |
| 139 // when find() would be misleading (e.g. you want to mark the second match in | 139 // when find() would be misleading (e.g. you want to mark the second match in |
| 140 // a string instead of the first). | 140 // a string instead of the first). |
| 141 static void ClassifyLocationInString(size_t match_location, | 141 static void ClassifyLocationInString(size_t match_location, |
| 142 size_t match_length, | 142 size_t match_length, |
| 143 size_t overall_length, | 143 size_t overall_length, |
| 144 int style, | 144 int style, |
| 145 ACMatchClassifications* classifications); | 145 ACMatchClassifications* classifications); |
| 146 | 146 |
| 147 // Returns a new vector of classifications containing the merged contents of |
| 148 // |classifications1| and |classifications2|. |
| 149 static ACMatchClassifications MergeClassifications( |
| 150 const ACMatchClassifications& classifications1, |
| 151 const ACMatchClassifications& classifications2); |
| 152 |
| 147 // Converts classifications to and from a serialized string representation | 153 // Converts classifications to and from a serialized string representation |
| 148 // (using comma-separated integers to sequentially list positions and styles). | 154 // (using comma-separated integers to sequentially list positions and styles). |
| 149 static std::string ClassificationsToString( | 155 static std::string ClassificationsToString( |
| 150 const ACMatchClassifications& classifications); | 156 const ACMatchClassifications& classifications); |
| 151 static ACMatchClassifications ClassificationsFromString( | 157 static ACMatchClassifications ClassificationsFromString( |
| 152 const std::string& serialized_classifications); | 158 const std::string& serialized_classifications); |
| 153 | 159 |
| 154 // Adds a classification to the end of |classifications| iff its style is | 160 // Adds a classification to the end of |classifications| iff its style is |
| 155 // different from the last existing classification. |offset| must be larger | 161 // different from the last existing classification. |offset| must be larger |
| 156 // than the offset of the last classification in |classifications|. | 162 // than the offset of the last classification in |classifications|. |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 const string16& text, | 325 const string16& text, |
| 320 const ACMatchClassifications& classifications) const; | 326 const ACMatchClassifications& classifications) const; |
| 321 #endif | 327 #endif |
| 322 }; | 328 }; |
| 323 | 329 |
| 324 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 330 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
| 325 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 331 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
| 326 typedef std::vector<AutocompleteMatch> ACMatches; | 332 typedef std::vector<AutocompleteMatch> ACMatches; |
| 327 | 333 |
| 328 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ | 334 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ |
| OLD | NEW |