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

Unified Diff: chrome/browser/autocomplete/search_provider.h

Issue 23164011: Omnibox: Reduce Bolding Flicker in SearchProvider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Mike's comments Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/search_provider.h
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index 8c8916a43438dce8fbd57637fc461d3e53c68961..1027da205651bd59e5e3a6c967611c120127e4c0 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -215,12 +215,16 @@ class SearchProvider : public AutocompleteProvider,
bool from_keyword_provider,
int relevance,
bool relevance_from_server,
- bool should_prefetch);
+ bool should_prefetch,
+ const base::string16& input_text);
Anuj 2014/01/06 23:23:38 I will prefer input_text as the first parameter.
Mark P 2014/01/07 19:10:31 The important thing in SuggestResult is the sugges
virtual ~SuggestResult();
const base::string16& suggestion() const { return suggestion_; }
AutocompleteMatchType::Type type() const { return type_; }
const base::string16& match_contents() const { return match_contents_; }
+ const ACMatchClassifications& match_contents_class() const {
+ return match_contents_class_;
+ }
const base::string16& annotation() const { return annotation_; }
const std::string& suggest_query_params() const {
return suggest_query_params_;
@@ -228,6 +232,13 @@ class SearchProvider : public AutocompleteProvider,
const std::string& deletion_url() const { return deletion_url_; }
bool should_prefetch() const { return should_prefetch_; }
+ // Fills in |match_contents_class| to reflect how |match_contents_| should
+ // be displayed and bolded against the current |input_text|. If
+ // |allow_bolding_all| is false and |match_contents_class_| would have all
+ // of |match_contents_| bolded, do nothing.
+ void CalculateContentsClass(const bool allow_bolding_all,
+ const base::string16& input_text);
+
// Result:
virtual bool IsInlineable(const base::string16& input) const OVERRIDE;
virtual int CalculateRelevance(
@@ -240,8 +251,9 @@ class SearchProvider : public AutocompleteProvider,
AutocompleteMatchType::Type type_;
- // The contents to be displayed in the autocomplete match.
+ // The contents to be displayed and its style info.
base::string16 match_contents_;
+ ACMatchClassifications match_contents_class_;
// Optional annotation for the |match_contents_| for disambiguation.
// This may be displayed in the autocomplete match contents, but is defined
@@ -370,6 +382,11 @@ class SearchProvider : public AutocompleteProvider,
SuggestResults* suggest_results,
NavigationResults* navigation_results);
+ // Recalculates the match contents class of |suggest_results| to better
+ // display against the current input.
+ static void RecalculateMatchContentsClass(const base::string16& input_text,
Anuj 2014/01/06 23:23:38 Minor suggestion : Rename to UpdateMatchContentsCl
Mark P 2014/01/07 19:10:31 Yeah, that's better. Done.
+ SuggestResults* suggest_results);
+
// Calculates the relevance score for the keyword verbatim result (if the
// input matches one of the profile's keyword).
static int CalculateRelevanceForKeywordVerbatim(AutocompleteInput::Type type,
« no previous file with comments | « no previous file | chrome/browser/autocomplete/search_provider.cc » ('j') | chrome/browser/autocomplete/search_provider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698