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

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: polish edit case Created 6 years, 12 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..fcc5b325cd7fc8179f96a3ce846e0e05e562af35 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);
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 {
msw 2014/01/06 21:09:00 nit: consider match_classifications_ or match_clas
Mark P 2014/01/06 22:20:16 I'd prefer to keep the name that corresponds to th
msw 2014/01/06 22:50:21 okay
+ 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,
msw 2014/01/06 21:09:00 nit: consider "Calculate[Match]Classifications".
Mark P 2014/01/06 22:20:16 see comment above.
+ const base::string16& input_text);
+
// Result:
virtual bool IsInlineable(const base::string16& input) const OVERRIDE;
virtual int CalculateRelevance(
@@ -240,8 +251,10 @@ class SearchProvider : public AutocompleteProvider,
AutocompleteMatchType::Type type_;
- // The contents to be displayed in the autocomplete match.
+ // The contents to be displayed in the autocomplete match, and its style
msw 2014/01/06 21:09:00 nit: remove "in the autocomplete match"
Mark P 2014/01/06 22:20:16 Done.
+ // 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 +383,12 @@ class SearchProvider : public AutocompleteProvider,
SuggestResults* suggest_results,
NavigationResults* navigation_results);
+ // For every result in |suggest_results|, call CalculateContentsClass(),
msw 2014/01/06 21:09:00 nit: consider "Recalculates the match contents and
Mark P 2014/01/06 22:20:16 Shortened it much like you suggested. In the proc
+ // which may replace its contents and bolding to better display against the
+ // current input.
+ static void RecalculateBolding(const base::string16& input_text,
msw 2014/01/06 21:09:00 nit: consider "Recalculate[Match]Classifications"
Mark P 2014/01/06 22:20:16 Good point. Changed to RecalculateMatchContentsCl
+ 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