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 8a7dcf7afcf5239cf824172ec1e49e685a8f91d0..92cd4362f09aae91442b62d753ea1e10b1066c6a 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,6 +115,7 @@ 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(); |
@@ -192,6 +194,7 @@ void ZeroSuggestProvider::Stop(bool clear_cached_results, |
results_.suggest_results.clear(); |
results_.navigation_results.clear(); |
current_query_.clear(); |
+ current_title_.clear(); |
most_visited_urls_.clear(); |
} |
} |
@@ -263,7 +266,7 @@ 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_), |
+ std::string(), GURL(current_query_), current_title_, |
current_page_classification_, true, false, false, |
true, false, client()->GetSchemeClassifier()); |
} |
@@ -481,7 +484,11 @@ 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_), |
+ const base::string16 description = |
+ (base::FeatureList::IsEnabled(omnibox::kDisplayTitleForCurrentUrl)) |
+ ? tmp.current_title() |
Mark P
2017/04/13 21:12:29
Is there a difference between tmp.current_title()
gcomanici
2017/04/18 18:52:53
No difference. I followed your suggestion.
|
+ : base::string16(); |
+ return VerbatimMatchForURL(client(), tmp, GURL(current_query_), description, |
history_url_provider_, |
results_.verbatim_relevance); |
} |