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

Side by Side Diff: components/omnibox/browser/autocomplete_result.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: Removed forced queries using '?'. Removed Ctrl-K preserving the user's keyword if they're already … Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autocomplete_result.h" 5 #include "components/omnibox/browser/autocomplete_result.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ? base::ASCIIToUTF16(default_match_->provider->GetName()) 246 ? base::ASCIIToUTF16(default_match_->provider->GetName())
247 : base::string16()) + 247 : base::string16()) +
248 base::ASCIIToUTF16(", input=") + 248 base::ASCIIToUTF16(", input=") +
249 input.text(); 249 input.text();
250 DCHECK(default_match_->allowed_to_be_default_match) << debug_info; 250 DCHECK(default_match_->allowed_to_be_default_match) << debug_info;
251 // If the default match is valid (i.e., not a prompt/placeholder), make 251 // If the default match is valid (i.e., not a prompt/placeholder), make
252 // sure the type of destination is what the user would expect given the 252 // sure the type of destination is what the user would expect given the
253 // input. 253 // input.
254 if (default_match_->destination_url.is_valid()) { 254 if (default_match_->destination_url.is_valid()) {
255 // We shouldn't get query matches for URL inputs, or non-query matches 255 // We shouldn't get query matches for URL inputs, or non-query matches
256 // for query inputs. 256 // for query inputs.
Peter Kasting 2016/04/13 02:52:16 Nit: Move this comment into the first conditional
Tom (Use chromium acct) 2016/04/13 23:37:40 Done.
257 if (AutocompleteMatch::IsSearchType(default_match_->type)) { 257 if (AutocompleteMatch::IsSearchType(default_match_->type)) {
258 DCHECK_NE(metrics::OmniboxInputType::URL, input.type()) << debug_info; 258 DCHECK_NE(metrics::OmniboxInputType::URL, input.type()) << debug_info;
259 } else { 259 } else {
260 DCHECK_NE(metrics::OmniboxInputType::FORCED_QUERY, input.type())
261 << debug_info;
262 // If the user explicitly typed a scheme, the default match should 260 // If the user explicitly typed a scheme, the default match should
263 // have the same scheme. 261 // have the same scheme.
264 if ((input.type() == metrics::OmniboxInputType::URL) && 262 if ((input.type() == metrics::OmniboxInputType::URL) &&
265 input.parts().scheme.is_nonempty()) { 263 input.parts().scheme.is_nonempty()) {
266 const std::string& in_scheme = base::UTF16ToUTF8(input.scheme()); 264 const std::string& in_scheme = base::UTF16ToUTF8(input.scheme());
267 const std::string& dest_scheme = 265 const std::string& dest_scheme =
268 default_match_->destination_url.scheme(); 266 default_match_->destination_url.scheme();
269 DCHECK(url_formatter::IsEquivalentScheme(in_scheme, dest_scheme)) 267 DCHECK(url_formatter::IsEquivalentScheme(in_scheme, dest_scheme))
270 << debug_info; 268 << debug_info;
271 } 269 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 i != old_matches.rend() && delta > 0; ++i) { 462 i != old_matches.rend() && delta > 0; ++i) {
465 if (!HasMatchByDestination(*i, new_matches)) { 463 if (!HasMatchByDestination(*i, new_matches)) {
466 AutocompleteMatch match = *i; 464 AutocompleteMatch match = *i;
467 match.relevance = std::min(max_relevance, match.relevance); 465 match.relevance = std::min(max_relevance, match.relevance);
468 match.from_previous = true; 466 match.from_previous = true;
469 matches_.push_back(match); 467 matches_.push_back(match);
470 delta--; 468 delta--;
471 } 469 }
472 } 470 }
473 } 471 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698