OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 #include <string> | 10 #include <string> |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // Similar to ClassifyMatchInString(), but for cases where the range to mark | 117 // Similar to ClassifyMatchInString(), but for cases where the range to mark |
118 // as matching is already known (avoids calling find()). This can be helpful | 118 // as matching is already known (avoids calling find()). This can be helpful |
119 // when find() would be misleading (e.g. you want to mark the second match in | 119 // when find() would be misleading (e.g. you want to mark the second match in |
120 // a string instead of the first). | 120 // a string instead of the first). |
121 static void ClassifyLocationInString(size_t match_location, | 121 static void ClassifyLocationInString(size_t match_location, |
122 size_t match_length, | 122 size_t match_length, |
123 size_t overall_length, | 123 size_t overall_length, |
124 int style, | 124 int style, |
125 ACMatchClassifications* classifications); | 125 ACMatchClassifications* classifications); |
126 | 126 |
| 127 // Removes invalid characters from |str|. Should be called on strings coming |
| 128 // from external sources (such as extensions) before assigning to |contents| |
| 129 // or |description|. |
| 130 static string16 SanitizeString(const string16& text); |
| 131 |
127 // The provider of this match, used to remember which provider the user had | 132 // The provider of this match, used to remember which provider the user had |
128 // selected when the input changes. This may be NULL, in which case there is | 133 // selected when the input changes. This may be NULL, in which case there is |
129 // no provider (or memory of the user's selection). | 134 // no provider (or memory of the user's selection). |
130 AutocompleteProvider* provider; | 135 AutocompleteProvider* provider; |
131 | 136 |
132 // The relevance of this match. See table in autocomplete.h for scores | 137 // The relevance of this match. See table in autocomplete.h for scores |
133 // returned by various providers. This is used to rank matches among all | 138 // returned by various providers. This is used to rank matches among all |
134 // responding providers, so different providers must be carefully tuned to | 139 // responding providers, so different providers must be carefully tuned to |
135 // supply matches with appropriate relevance. | 140 // supply matches with appropriate relevance. |
136 // | 141 // |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void ValidateClassifications( | 199 void ValidateClassifications( |
195 const string16& text, | 200 const string16& text, |
196 const ACMatchClassifications& classifications) const; | 201 const ACMatchClassifications& classifications) const; |
197 #endif | 202 #endif |
198 }; | 203 }; |
199 | 204 |
200 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 205 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
201 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 206 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
202 | 207 |
203 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ | 208 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ |
OLD | NEW |