Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/omnibox/browser/physical_web_provider.h" | 5 #include "components/omnibox/browser/physical_web_provider.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 (empty_input_from_user && !after_typing_enabled_)) { | 95 (empty_input_from_user && !after_typing_enabled_)) { |
| 96 matches_.clear(); | 96 matches_.clear(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 // In zero-suggest, Physical Web matches should never be default. If the | 99 // In zero-suggest, Physical Web matches should never be default. If the |
| 100 // omnibox input is non-empty and we have at least one Physical Web match, | 100 // omnibox input is non-empty and we have at least one Physical Web match, |
| 101 // add the current URL as the default so that hitting enter after focusing | 101 // add the current URL as the default so that hitting enter after focusing |
| 102 // the omnibox causes the current page to reload. If the input field is | 102 // the omnibox causes the current page to reload. If the input field is |
| 103 // empty, no default match is required. | 103 // empty, no default match is required. |
| 104 if (!matches_.empty() && !input.text().empty()) { | 104 if (!matches_.empty() && !input.text().empty()) { |
| 105 matches_.push_back(VerbatimMatchForURL( | 105 matches_.push_back( |
| 106 client_, input, input.current_url(), history_url_provider_, -1)); | 106 VerbatimMatchForURL(client_, input, input.current_url(), |
|
Mark P
2017/04/13 21:12:28
Please use the title of the current page here too
gcomanici
2017/04/18 18:52:52
Done.
| |
| 107 base::string16(), history_url_provider_, -1)); | |
| 107 } | 108 } |
| 108 } else { | 109 } else { |
| 109 ConstructQuerySuggestMatches(std::move(metadata_list), input); | 110 ConstructQuerySuggestMatches(std::move(metadata_list), input); |
| 110 | 111 |
| 111 if (!matches_.empty()) { | 112 if (!matches_.empty()) { |
| 112 had_physical_web_suggestions_ = true; | 113 had_physical_web_suggestions_ = true; |
| 113 had_physical_web_suggestions_at_focus_or_later_ = true; | 114 had_physical_web_suggestions_at_focus_or_later_ = true; |
| 114 } | 115 } |
| 115 | 116 |
| 116 // Don't show Physical Web suggestions after the user starts typing unless | 117 // Don't show Physical Web suggestions after the user starts typing unless |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 AutocompleteInput::FormattedStringWithEquivalentMeaning( | 310 AutocompleteInput::FormattedStringWithEquivalentMeaning( |
| 310 url, match.contents, client_->GetSchemeClassifier()); | 311 url, match.contents, client_->GetSchemeClassifier()); |
| 311 | 312 |
| 312 match.description = | 313 match.description = |
| 313 l10n_util::GetStringUTF16(IDS_PHYSICAL_WEB_OVERFLOW_DESCRIPTION); | 314 l10n_util::GetStringUTF16(IDS_PHYSICAL_WEB_OVERFLOW_DESCRIPTION); |
| 314 match.description_class.push_back( | 315 match.description_class.push_back( |
| 315 ACMatchClassification(0, ACMatchClassification::NONE)); | 316 ACMatchClassification(0, ACMatchClassification::NONE)); |
| 316 | 317 |
| 317 matches_.push_back(match); | 318 matches_.push_back(match); |
| 318 } | 319 } |
| OLD | NEW |