Chromium Code Reviews| Index: components/omnibox/browser/physical_web_provider.cc |
| diff --git a/components/omnibox/browser/physical_web_provider.cc b/components/omnibox/browser/physical_web_provider.cc |
| index 4159ee1e2d8cf297c9d3679b02f39b0d5be77a97..36aec4699e8afec52f21c061b49527bba18384df 100644 |
| --- a/components/omnibox/browser/physical_web_provider.cc |
| +++ b/components/omnibox/browser/physical_web_provider.cc |
| @@ -75,7 +75,10 @@ void PhysicalWebProvider::Start(const AutocompleteInput& input, |
| return; |
| } |
| - if (input.from_omnibox_focus()) { |
| + bool input_from_focus = input.from_omnibox_focus(); |
|
Mark P
2017/01/25 20:19:47
nit: both const
mattreynolds
2017/01/25 22:01:52
Done.
|
| + bool empty_input_from_user = !input_from_focus && input.text().empty(); |
| + |
| + if (input_from_focus || empty_input_from_user) { |
| ConstructZeroSuggestMatches(data_source->GetMetadataList()); |
| if (!matches_.empty()) { |
| @@ -83,7 +86,12 @@ void PhysicalWebProvider::Start(const AutocompleteInput& input, |
| had_physical_web_suggestions_at_focus_or_later_ = true; |
| } |
| - if (!zero_suggest_enabled_) { |
| + // Don't show zero-suggest suggestions unless the PhysicalWebZeroSuggest |
| + // omnibox experiment parameter is enabled. If the omnibox input is empty |
| + // because the user cleared it, also require that PhysicalWebAfterTyping is |
| + // enabled. |
| + if (!zero_suggest_enabled_ || |
| + (empty_input_from_user && !after_typing_enabled_)) { |
| matches_.clear(); |
| } |
| @@ -104,6 +112,8 @@ void PhysicalWebProvider::Start(const AutocompleteInput& input, |
| had_physical_web_suggestions_at_focus_or_later_ = true; |
| } |
| + // Don't show Physical Web suggestions after the user starts typing unless |
| + // the PhysicalWebAfterTyping omnibox experiment parameter is enabled. |
| if (!after_typing_enabled_) { |
| matches_.clear(); |
| } |