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

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

Issue 10692075: Enhance chrome://omnibox Presentation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Sync to tree for final review. Created 8 years, 5 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <map>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "chrome/browser/search_engines/template_url.h" 13 #include "chrome/browser/search_engines/template_url.h"
13 #include "content/public/common/page_transition_types.h" 14 #include "content/public/common/page_transition_types.h"
14 #include "googleurl/src/gurl.h" 15 #include "googleurl/src/gurl.h"
15 16
16 class AutocompleteProvider; 17 class AutocompleteProvider;
17 class Profile; 18 class Profile;
18 class TemplateURL; 19 class TemplateURL;
19 20
21 namespace base {
22 class Time;
23 } // namespace base
24
20 // AutocompleteMatch ---------------------------------------------------------- 25 // AutocompleteMatch ----------------------------------------------------------
21 26
22 // A single result line with classified spans. The autocomplete popup displays 27 // A single result line with classified spans. The autocomplete popup displays
23 // the 'contents' and the 'description' (the description is optional) in the 28 // the 'contents' and the 'description' (the description is optional) in the
24 // autocomplete dropdown, and fills in 'fill_into_edit' into the textbox when 29 // autocomplete dropdown, and fills in 'fill_into_edit' into the textbox when
25 // that line is selected. fill_into_edit may be the same as 'description' for 30 // that line is selected. fill_into_edit may be the same as 'description' for
26 // things like URLs, but may be different for searches or other providers. For 31 // things like URLs, but may be different for searches or other providers. For
27 // example, a search result may say "Search for asdf" as the description, but 32 // example, a search result may say "Search for asdf" as the description, but
28 // "asdf" should appear in the box. 33 // "asdf" should appear in the box.
29 struct AutocompleteMatch { 34 struct AutocompleteMatch {
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // invoke its keyword), this returns the empty string. The result is that 187 // invoke its keyword), this returns the empty string. The result is that
183 // this function returns a non-empty string in the same cases as when the UI 188 // this function returns a non-empty string in the same cases as when the UI
184 // should show up as being "in keyword mode". 189 // should show up as being "in keyword mode".
185 string16 GetSubstitutingExplicitlyInvokedKeyword(Profile* profile) const; 190 string16 GetSubstitutingExplicitlyInvokedKeyword(Profile* profile) const;
186 191
187 // Returns the TemplateURL associated with this match. This may be NULL if 192 // Returns the TemplateURL associated with this match. This may be NULL if
188 // the match has no keyword OR if the keyword no longer corresponds to a valid 193 // the match has no keyword OR if the keyword no longer corresponds to a valid
189 // TemplateURL. See comments on |keyword| below. 194 // TemplateURL. See comments on |keyword| below.
190 TemplateURL* GetTemplateURL(Profile* profile) const; 195 TemplateURL* GetTemplateURL(Profile* profile) const;
191 196
197 // Adds diagnostic information to the |diagnostics| dictionary.
Peter Kasting 2012/07/26 02:31:37 Nit: Up to you, but I think "optional info" might
mrossetti 2012/07/26 23:17:13 I like that idea but I used |additional_info| -- I
198 void RecordDiagnostic(const std::string& property, const std::string& value);
199 void RecordDiagnostic(const std::string& property, int value);
200 void RecordDiagnostic(const std::string& property, const base::Time& value);
201
192 // The provider of this match, used to remember which provider the user had 202 // The provider of this match, used to remember which provider the user had
193 // selected when the input changes. This may be NULL, in which case there is 203 // selected when the input changes. This may be NULL, in which case there is
194 // no provider (or memory of the user's selection). 204 // no provider (or memory of the user's selection).
195 AutocompleteProvider* provider; 205 AutocompleteProvider* provider;
196 206
197 // The relevance of this match. See table in autocomplete.h for scores 207 // The relevance of this match. See table in autocomplete.h for scores
198 // returned by various providers. This is used to rank matches among all 208 // returned by various providers. This is used to rank matches among all
199 // responding providers, so different providers must be carefully tuned to 209 // responding providers, so different providers must be carefully tuned to
200 // supply matches with appropriate relevance. 210 // supply matches with appropriate relevance.
201 // 211 //
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 286
277 // Optional search terms args. If present, 287 // Optional search terms args. If present,
278 // AutocompleteController::UpdateAssistedQueryStats() will incorporate this 288 // AutocompleteController::UpdateAssistedQueryStats() will incorporate this
279 // data with additional data it calculates and pass the completed struct to 289 // data with additional data it calculates and pass the completed struct to
280 // TemplateURLRef::ReplaceSearchTerms() to reset the match's |destination_url| 290 // TemplateURLRef::ReplaceSearchTerms() to reset the match's |destination_url|
281 // after the complete set of matches in the AutocompleteResult has been chosen 291 // after the complete set of matches in the AutocompleteResult has been chosen
282 // and sorted. Most providers will leave this as NULL, which will cause the 292 // and sorted. Most providers will leave this as NULL, which will cause the
283 // AutocompleteController to do no additional transformations. 293 // AutocompleteController to do no additional transformations.
284 scoped_ptr<TemplateURLRef::SearchTermsArgs> search_terms_args; 294 scoped_ptr<TemplateURLRef::SearchTermsArgs> search_terms_args;
285 295
296 // Diagnostic information dictionary into which each provider can optionally
297 // record a property and associated value and which is presented in
298 // chrome://omnibox.
299 std::map<std::string, std::string> diagnostics;
Peter Kasting 2012/07/26 02:31:37 Nit: Might want a "typedef std::map<std::string, s
mrossetti 2012/07/26 23:17:13 Done.
300
286 #ifndef NDEBUG 301 #ifndef NDEBUG
287 // Does a data integrity check on this match. 302 // Does a data integrity check on this match.
288 void Validate() const; 303 void Validate() const;
289 304
290 // Checks one text/classifications pair for valid values. 305 // Checks one text/classifications pair for valid values.
291 void ValidateClassifications( 306 void ValidateClassifications(
292 const string16& text, 307 const string16& text,
293 const ACMatchClassifications& classifications) const; 308 const ACMatchClassifications& classifications) const;
294 #endif 309 #endif
295 }; 310 };
296 311
297 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification; 312 typedef AutocompleteMatch::ACMatchClassification ACMatchClassification;
298 typedef std::vector<ACMatchClassification> ACMatchClassifications; 313 typedef std::vector<ACMatchClassification> ACMatchClassifications;
299 typedef std::vector<AutocompleteMatch> ACMatches; 314 typedef std::vector<AutocompleteMatch> ACMatches;
300 315
301 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_ 316 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_MATCH_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autocomplete/autocomplete_match.cc » ('j') | chrome/browser/resources/omnibox/omnibox.css » ('J')

Powered by Google App Engine
This is Rietveld 408576698