Index: components/omnibox/browser/zero_suggest_provider.cc |
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc |
index 8ca495ac321f51b61ea9ecf116e67e7d32ba89da..50f95096897f42790d9c6219998eb312290a75db 100644 |
--- a/components/omnibox/browser/zero_suggest_provider.cc |
+++ b/components/omnibox/browser/zero_suggest_provider.cc |
@@ -7,6 +7,7 @@ |
#include <stddef.h> |
#include "base/callback.h" |
+#include "base/feature_list.h" |
#include "base/i18n/case_conversion.h" |
#include "base/json/json_string_value_serializer.h" |
#include "base/metrics/histogram_macros.h" |
@@ -114,9 +115,9 @@ void ZeroSuggestProvider::Start(const AutocompleteInput& input, |
results_from_cache_ = false; |
permanent_text_ = input.text(); |
current_query_ = input.current_url().spec(); |
+ current_title_ = input.current_title(); |
current_page_classification_ = input.current_page_classification(); |
current_url_match_ = MatchForCurrentURL(); |
- |
std::string url_string = GetContextualSuggestionsUrl(); |
GURL suggest_url(url_string); |
if (!suggest_url.is_valid()) |
@@ -262,10 +263,10 @@ const TemplateURL* ZeroSuggestProvider::GetTemplateURL(bool is_keyword) const { |
const AutocompleteInput ZeroSuggestProvider::GetInput(bool is_keyword) const { |
// The callers of this method won't look at the AutocompleteInput's |
// |from_omnibox_focus| member, so we can set its value to false. |
- return AutocompleteInput(base::string16(), base::string16::npos, |
- std::string(), GURL(current_query_), |
- current_page_classification_, true, false, false, |
- true, false, client()->GetSchemeClassifier()); |
+ return AutocompleteInput( |
+ base::string16(), base::string16::npos, std::string(), |
+ GURL(current_query_), base::string16(), current_page_classification_, |
+ true, false, false, true, false, client()->GetSchemeClassifier()); |
} |
bool ZeroSuggestProvider::ShouldAppendExtraParams( |
@@ -481,9 +482,17 @@ AutocompleteMatch ZeroSuggestProvider::MatchForCurrentURL() { |
// gets dropped as soon as the user types something. |
AutocompleteInput tmp(GetInput(false)); |
tmp.UpdateText(permanent_text_, base::string16::npos, tmp.parts()); |
- return VerbatimMatchForURL(client(), tmp, GURL(current_query_), |
- history_url_provider_, |
- results_.verbatim_relevance); |
+ auto match = |
+ VerbatimMatchForURL(client(), tmp, GURL(current_query_), |
Mark P
2017/04/10 22:38:02
Instead of this, please pass the title all the way
gcomanici
2017/04/11 20:51:41
Done.
|
+ history_url_provider_, results_.verbatim_relevance); |
+ if (base::FeatureList::IsEnabled( |
+ omnibox::kIncludeTitleToACMatchForCurrentUrl)) { |
+ match.description = current_title_; |
+ AutocompleteMatch::ClassifyLocationInString( |
+ base::string16::npos, 0, match.description.length(), |
+ ACMatchClassification::NONE, &match.description_class); |
+ } |
+ return match; |
} |
bool ZeroSuggestProvider::ShouldShowNonContextualZeroSuggest( |