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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_match.h

Issue 7607007: Add confidence to AutocompleteMatch. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 EXTENSION_APP, // An Extension App with a title/url that contains 80 EXTENSION_APP, // An Extension App with a title/url that contains
81 // the input. 81 // the input.
82 NUM_TYPES, 82 NUM_TYPES,
83 }; 83 };
84 84
85 AutocompleteMatch(); 85 AutocompleteMatch();
86 AutocompleteMatch(AutocompleteProvider* provider, 86 AutocompleteMatch(AutocompleteProvider* provider,
87 int relevance, 87 int relevance,
88 float confidence,
88 bool deletable, 89 bool deletable,
89 Type type); 90 Type type);
90 ~AutocompleteMatch(); 91 ~AutocompleteMatch();
91 92
92 // Converts |type| to a string representation. Used in logging. 93 // Converts |type| to a string representation. Used in logging.
93 static std::string TypeToString(Type type); 94 static std::string TypeToString(Type type);
94 95
95 // Converts |type| to a resource identifier for the appropriate icon for this 96 // Converts |type| to a resource identifier for the appropriate icon for this
96 // type. 97 // type.
97 static int TypeToIcon(Type type); 98 static int TypeToIcon(Type type);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 133
133 // The relevance of this match. See table in autocomplete.h for scores 134 // The relevance of this match. See table in autocomplete.h for scores
134 // returned by various providers. This is used to rank matches among all 135 // returned by various providers. This is used to rank matches among all
135 // responding providers, so different providers must be carefully tuned to 136 // responding providers, so different providers must be carefully tuned to
136 // supply matches with appropriate relevance. 137 // supply matches with appropriate relevance.
137 // 138 //
138 // TODO(pkasting): http://b/1111299 This should be calculated algorithmically, 139 // TODO(pkasting): http://b/1111299 This should be calculated algorithmically,
139 // rather than being a fairly fixed value defined by the table above. 140 // rather than being a fairly fixed value defined by the table above.
140 int relevance; 141 int relevance;
141 142
143 // The confidence of the match. Calculated per provider and a measure in the
144 // range [0, 1].
145 float confidence;
146
142 // True if the user should be able to delete this match. 147 // True if the user should be able to delete this match.
143 bool deletable; 148 bool deletable;
144 149
145 // This string is loaded into the location bar when the item is selected 150 // This string is loaded into the location bar when the item is selected
146 // by pressing the arrow keys. This may be different than a URL, for example, 151 // by pressing the arrow keys. This may be different than a URL, for example,
147 // for search suggestions, this would just be the search terms. 152 // for search suggestions, this would just be the search terms.
148 string16 fill_into_edit; 153 string16 fill_into_edit;
149 154
150 // The position within fill_into_edit from which we'll display the inline 155 // The position within fill_into_edit from which we'll display the inline
151 // autocomplete string. This will be string16::npos if this match should 156 // autocomplete string. This will be string16::npos if this match should
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 void ValidateClassifications( 200 void ValidateClassifications(
196 const string16& text, 201 const string16& text,
197 const ACMatchClassifications& classifications) const; 202 const ACMatchClassifications& classifications) const;
198 #endif 203 #endif
199 }; 204 };
200 205
201 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; 206 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification;
202 typedef std::vector<ACMatchClassification> ACMatchClassifications; 207 typedef std::vector<ACMatchClassification> ACMatchClassifications;
203 208
204 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ 209 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_edit.cc ('k') | chrome/browser/autocomplete/autocomplete_match.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698