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

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

Powered by Google App Engine
This is Rietveld 408576698