OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 5 #ifndef COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 6 #define COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 AutocompleteMatch(AutocompleteProvider* provider, | 101 AutocompleteMatch(AutocompleteProvider* provider, |
102 int relevance, | 102 int relevance, |
103 bool deletable, | 103 bool deletable, |
104 Type type); | 104 Type type); |
105 AutocompleteMatch(const AutocompleteMatch& match); | 105 AutocompleteMatch(const AutocompleteMatch& match); |
106 ~AutocompleteMatch(); | 106 ~AutocompleteMatch(); |
107 | 107 |
108 // Converts |type| to a string representation. Used in logging and debugging. | 108 // Converts |type| to a string representation. Used in logging and debugging. |
109 AutocompleteMatch& operator=(const AutocompleteMatch& match); | 109 AutocompleteMatch& operator=(const AutocompleteMatch& match); |
110 | 110 |
| 111 // Converts |type| to a resource identifier for the appropriate icon for this |
| 112 // type to show in the completion popup. |
| 113 static int TypeToIcon(Type type); |
| 114 |
111 // Gets the vector icon identifier for the icon to be shown for |type|. | 115 // Gets the vector icon identifier for the icon to be shown for |type|. |
112 static gfx::VectorIconId TypeToVectorIcon(Type type); | 116 static gfx::VectorIconId TypeToVectorIcon(Type type); |
113 | 117 |
114 // Comparison function for determining when one match is better than another. | 118 // Comparison function for determining when one match is better than another. |
115 static bool MoreRelevant(const AutocompleteMatch& elem1, | 119 static bool MoreRelevant(const AutocompleteMatch& elem1, |
116 const AutocompleteMatch& elem2); | 120 const AutocompleteMatch& elem2); |
117 | 121 |
118 // Comparison function for removing matches with duplicate destinations. | 122 // Comparison function for removing matches with duplicate destinations. |
119 // Destinations are compared using |stripped_destination_url|. Pairs of | 123 // Destinations are compared using |stripped_destination_url|. Pairs of |
120 // matches with empty destinations are treated as differing, since empty | 124 // matches with empty destinations are treated as differing, since empty |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 const base::string16& text, | 424 const base::string16& text, |
421 const ACMatchClassifications& classifications) const; | 425 const ACMatchClassifications& classifications) const; |
422 #endif | 426 #endif |
423 }; | 427 }; |
424 | 428 |
425 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 429 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
426 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 430 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
427 typedef std::vector<AutocompleteMatch> ACMatches; | 431 typedef std::vector<AutocompleteMatch> ACMatches; |
428 | 432 |
429 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 433 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
OLD | NEW |