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, |