| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 HISTORY_TITLE, // A past page whose title contains the input. | 70 HISTORY_TITLE, // A past page whose title contains the input. |
| 71 HISTORY_BODY, // A past page whose body contains the input. | 71 HISTORY_BODY, // A past page whose body contains the input. |
| 72 HISTORY_KEYWORD, // A past page whose keyword contains the input. | 72 HISTORY_KEYWORD, // A past page whose keyword contains the input. |
| 73 NAVSUGGEST, // A suggested URL. | 73 NAVSUGGEST, // A suggested URL. |
| 74 SEARCH_WHAT_YOU_TYPED, // The input as a search query (with the default | 74 SEARCH_WHAT_YOU_TYPED, // The input as a search query (with the default |
| 75 // engine). | 75 // engine). |
| 76 SEARCH_HISTORY, // A past search (with the default engine) | 76 SEARCH_HISTORY, // A past search (with the default engine) |
| 77 // containing the input. | 77 // containing the input. |
| 78 SEARCH_SUGGEST, // A suggested search (with the default engine). | 78 SEARCH_SUGGEST, // A suggested search (with the default engine). |
| 79 SEARCH_OTHER_ENGINE, // A search with a non-default engine. | 79 SEARCH_OTHER_ENGINE, // A search with a non-default engine. |
| 80 OPEN_HISTORY_PAGE, // A synthetic result that opens the history page | |
| 81 // to search for the input. | |
| 82 NUM_TYPES, | 80 NUM_TYPES, |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 AutocompleteMatch(); | 83 AutocompleteMatch(); |
| 86 AutocompleteMatch(AutocompleteProvider* provider, | 84 AutocompleteMatch(AutocompleteProvider* provider, |
| 87 int relevance, | 85 int relevance, |
| 88 bool deletable, | 86 bool deletable, |
| 89 Type type); | 87 Type type); |
| 90 ~AutocompleteMatch(); | 88 ~AutocompleteMatch(); |
| 91 | 89 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 // The provider of this match, used to remember which provider the user had | 126 // The provider of this match, used to remember which provider the user had |
| 129 // selected when the input changes. This may be NULL, in which case there is | 127 // selected when the input changes. This may be NULL, in which case there is |
| 130 // no provider (or memory of the user's selection). | 128 // no provider (or memory of the user's selection). |
| 131 AutocompleteProvider* provider; | 129 AutocompleteProvider* provider; |
| 132 | 130 |
| 133 // The relevance of this match. See table above for scores returned by | 131 // The relevance of this match. See table above for scores returned by |
| 134 // various providers. This is used to rank matches among all responding | 132 // various providers. This is used to rank matches among all responding |
| 135 // providers, so different providers must be carefully tuned to supply | 133 // providers, so different providers must be carefully tuned to supply |
| 136 // matches with appropriate relevance. | 134 // matches with appropriate relevance. |
| 137 // | 135 // |
| 138 // If the relevance is negative, it will only be displayed if there are not | |
| 139 // enough non-negative items in all the providers to max out the popup. In | |
| 140 // this case, the relevance of the additional items will be inverted so they | |
| 141 // can be mixed in with the rest of the relevances. This allows a provider | |
| 142 // to group its matches, having the added items appear intermixed with its | |
| 143 // other matches. | |
| 144 // | |
| 145 // TODO(pkasting): http://b/1111299 This should be calculated algorithmically, | 136 // TODO(pkasting): http://b/1111299 This should be calculated algorithmically, |
| 146 // rather than being a fairly fixed value defined by the table above. | 137 // rather than being a fairly fixed value defined by the table above. |
| 147 int relevance; | 138 int relevance; |
| 148 | 139 |
| 149 // True if the user should be able to delete this match. | 140 // True if the user should be able to delete this match. |
| 150 bool deletable; | 141 bool deletable; |
| 151 | 142 |
| 152 // This string is loaded into the location bar when the item is selected | 143 // This string is loaded into the location bar when the item is selected |
| 153 // by pressing the arrow keys. This may be different than a URL, for example, | 144 // by pressing the arrow keys. This may be different than a URL, for example, |
| 154 // for search suggestions, this would just be the search terms. | 145 // for search suggestions, this would just be the search terms. |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 void ValidateClassifications( | 190 void ValidateClassifications( |
| 200 const std::wstring& text, | 191 const std::wstring& text, |
| 201 const ACMatchClassifications& classifications) const; | 192 const ACMatchClassifications& classifications) const; |
| 202 #endif | 193 #endif |
| 203 }; | 194 }; |
| 204 | 195 |
| 205 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 196 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
| 206 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 197 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
| 207 | 198 |
| 208 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ | 199 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ |
| OLD | NEW |