Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: components/omnibox/browser/autocomplete_input.cc

Issue 1855423003: Interpret '?' and Ctrl-K or Ctrl-E as putting omnibox in keyword search mode for Default Search Pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add includes for mac tests Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/omnibox/browser/autocomplete_input.cc
diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc
index f8673d725a7fa0712a6e2d64dc20fb8ab126f756..e51ddff813e775557fcff4803e063eb155b31b26 100644
--- a/components/omnibox/browser/autocomplete_input.cc
+++ b/components/omnibox/browser/autocomplete_input.cc
@@ -120,19 +120,6 @@ AutocompleteInput::AutocompleteInput(
canonicalized_url.SchemeIsFileSystem() ||
!canonicalized_url.host().empty()))
canonicalized_url_ = canonicalized_url;
-
- size_t chars_removed = RemoveForcedQueryStringIfNecessary(type_, &text_);
- AdjustCursorPositionIfNecessary(chars_removed, &cursor_position_);
- if (chars_removed) {
- // Remove spaces between opening question mark and first actual character.
- base::string16 trimmed_text;
- if ((base::TrimWhitespace(text_, base::TRIM_LEADING, &trimmed_text) &
- base::TRIM_LEADING) != 0) {
- AdjustCursorPositionIfNecessary(text_.length() - trimmed_text.length(),
- &cursor_position_);
- text_ = trimmed_text;
- }
- }
}
AutocompleteInput::AutocompleteInput(const AutocompleteInput& other) = default;
@@ -141,18 +128,6 @@ AutocompleteInput::~AutocompleteInput() {
}
// static
-size_t AutocompleteInput::RemoveForcedQueryStringIfNecessary(
- metrics::OmniboxInputType::Type type,
- base::string16* text) {
- if ((type != metrics::OmniboxInputType::FORCED_QUERY) || text->empty() ||
- (*text)[0] != L'?')
- return 0;
- // Drop the leading '?'.
- text->erase(0, 1);
- return 1;
-}
-
-// static
std::string AutocompleteInput::TypeToString(
metrics::OmniboxInputType::Type type) {
switch (type) {
@@ -162,7 +137,8 @@ std::string AutocompleteInput::TypeToString(
return "deprecated-requested-url";
case metrics::OmniboxInputType::URL: return "url";
case metrics::OmniboxInputType::QUERY: return "query";
- case metrics::OmniboxInputType::FORCED_QUERY: return "forced-query";
+ case metrics::OmniboxInputType::DEPRECATED_FORCED_QUERY:
+ return "deprecated-forced-query";
}
return std::string();
}
@@ -179,12 +155,6 @@ metrics::OmniboxInputType::Type AutocompleteInput::Parse(
if (first_non_white == base::string16::npos)
return metrics::OmniboxInputType::INVALID; // All whitespace.
- if (text[first_non_white] == L'?') {
- // If the first non-whitespace character is a '?', we magically treat this
- // as a query.
- return metrics::OmniboxInputType::FORCED_QUERY;
- }
-
// Ask our parsing back-end to help us understand what the user typed. We
// use the URLFixerUpper here because we want to be smart about what we
// consider a scheme. For example, we shouldn't consider www.google.com:80
« no previous file with comments | « components/omnibox/browser/autocomplete_input.h ('k') | components/omnibox/browser/autocomplete_input_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698