Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(306)

Side by Side Diff: components/omnibox/browser/autocomplete_match.h

Issue 1418543002: Vectorize omnibox dropdown icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add gyp dependency Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/omnibox.gypi ('k') | components/omnibox/browser/autocomplete_match.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "components/omnibox/browser/autocomplete_input.h" 13 #include "components/omnibox/browser/autocomplete_input.h"
14 #include "components/omnibox/browser/autocomplete_match_type.h" 14 #include "components/omnibox/browser/autocomplete_match_type.h"
15 #include "components/search_engines/template_url.h" 15 #include "components/search_engines/template_url.h"
16 #include "ui/base/page_transition_types.h" 16 #include "ui/base/page_transition_types.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 class AutocompleteProvider; 19 class AutocompleteProvider;
20 class SuggestionAnswer; 20 class SuggestionAnswer;
21 class TemplateURL; 21 class TemplateURL;
22 class TemplateURLService; 22 class TemplateURLService;
23 23
24 namespace base { 24 namespace base {
25 class Time; 25 class Time;
26 } // namespace base 26 } // namespace base
27 27
28 namespace gfx {
29 enum class VectorIconId;
30 } // namespace gfx
31
28 const char kACMatchPropertyInputText[] = "input text"; 32 const char kACMatchPropertyInputText[] = "input text";
29 const char kACMatchPropertyContentsPrefix[] = "match contents prefix"; 33 const char kACMatchPropertyContentsPrefix[] = "match contents prefix";
30 const char kACMatchPropertyContentsStartIndex[] = "match contents start index"; 34 const char kACMatchPropertyContentsStartIndex[] = "match contents start index";
31 35
32 // AutocompleteMatch ---------------------------------------------------------- 36 // AutocompleteMatch ----------------------------------------------------------
33 37
34 // A single result line with classified spans. The autocomplete popup displays 38 // A single result line with classified spans. The autocomplete popup displays
35 // the 'contents' and the 'description' (the description is optional) in the 39 // the 'contents' and the 'description' (the description is optional) in the
36 // autocomplete dropdown, and fills in 'fill_into_edit' into the textbox when 40 // autocomplete dropdown, and fills in 'fill_into_edit' into the textbox when
37 // that line is selected. fill_into_edit may be the same as 'description' for 41 // that line is selected. fill_into_edit may be the same as 'description' for
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 AutocompleteMatch(const AutocompleteMatch& match); 99 AutocompleteMatch(const AutocompleteMatch& match);
96 ~AutocompleteMatch(); 100 ~AutocompleteMatch();
97 101
98 // Converts |type| to a string representation. Used in logging and debugging. 102 // Converts |type| to a string representation. Used in logging and debugging.
99 AutocompleteMatch& operator=(const AutocompleteMatch& match); 103 AutocompleteMatch& operator=(const AutocompleteMatch& match);
100 104
101 // Converts |type| to a resource identifier for the appropriate icon for this 105 // Converts |type| to a resource identifier for the appropriate icon for this
102 // type to show in the completion popup. 106 // type to show in the completion popup.
103 static int TypeToIcon(Type type); 107 static int TypeToIcon(Type type);
104 108
109 // Gets the vector icon identifier for the icon to be shown for |type|.
110 static gfx::VectorIconId TypeToVectorIcon(Type type);
111
105 // Comparison function for determining when one match is better than another. 112 // Comparison function for determining when one match is better than another.
106 static bool MoreRelevant(const AutocompleteMatch& elem1, 113 static bool MoreRelevant(const AutocompleteMatch& elem1,
107 const AutocompleteMatch& elem2); 114 const AutocompleteMatch& elem2);
108 115
109 // Comparison function for removing matches with duplicate destinations. 116 // Comparison function for removing matches with duplicate destinations.
110 // Destinations are compared using |stripped_destination_url|. Pairs of 117 // Destinations are compared using |stripped_destination_url|. Pairs of
111 // matches with empty destinations are treated as differing, since empty 118 // matches with empty destinations are treated as differing, since empty
112 // destinations are expected for non-navigable matches. 119 // destinations are expected for non-navigable matches.
113 static bool DestinationsEqual(const AutocompleteMatch& elem1, 120 static bool DestinationsEqual(const AutocompleteMatch& elem1,
114 const AutocompleteMatch& elem2); 121 const AutocompleteMatch& elem2);
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 const base::string16& text, 422 const base::string16& text,
416 const ACMatchClassifications& classifications) const; 423 const ACMatchClassifications& classifications) const;
417 #endif 424 #endif
418 }; 425 };
419 426
420 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; 427 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification;
421 typedef std::vector<ACMatchClassification> ACMatchClassifications; 428 typedef std::vector<ACMatchClassification> ACMatchClassifications;
422 typedef std::vector<AutocompleteMatch> ACMatches; 429 typedef std::vector<AutocompleteMatch> ACMatches;
423 430
424 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_ 431 #endif // COMPONENTS_OMNIBOX_BROWSER_AUTOCOMPLETE_MATCH_H_
OLDNEW
« no previous file with comments | « components/omnibox.gypi ('k') | components/omnibox/browser/autocomplete_match.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698