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 | |
115 // Gets the vector icon identifier for the icon to be shown for |type|. | 111 // Gets the vector icon identifier for the icon to be shown for |type|. |
116 static gfx::VectorIconId TypeToVectorIcon(Type type); | 112 static gfx::VectorIconId TypeToVectorIcon(Type type); |
117 | 113 |
118 // Comparison function for determining when one match is better than another. | 114 // Comparison function for determining when one match is better than another. |
119 static bool MoreRelevant(const AutocompleteMatch& elem1, | 115 static bool MoreRelevant(const AutocompleteMatch& elem1, |
120 const AutocompleteMatch& elem2); | 116 const AutocompleteMatch& elem2); |
121 | 117 |
122 // Comparison function for removing matches with duplicate destinations. | 118 // Comparison function for removing matches with duplicate destinations. |
123 // Destinations are compared using |stripped_destination_url|. Pairs of | 119 // Destinations are compared using |stripped_destination_url|. Pairs of |
124 // matches with empty destinations are treated as differing, since empty | 120 // matches with empty destinations are treated as differing, since empty |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 const base::string16& text, | 420 const base::string16& text, |
425 const ACMatchClassifications& classifications) const; | 421 const ACMatchClassifications& classifications) const; |
426 #endif | 422 #endif |
427 }; | 423 }; |
428 | 424 |
429 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; | 425 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; |
430 typedef std::vector<ACMatchClassification> ACMatchClassifications; | 426 typedef std::vector<ACMatchClassification> ACMatchClassifications; |
431 typedef std::vector<AutocompleteMatch> ACMatches; | 427 typedef std::vector<AutocompleteMatch> ACMatches; |
432 | 428 |
433 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ | 429 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ |
OLD | NEW |