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

Side by Side Diff: components/omnibox/browser/autocomplete_input.cc

Issue 2446273004: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Review comment Created 4 years, 1 month 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_input.h" 5 #include "components/omnibox/browser/autocomplete_input.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // the already-canonicalized host rather than using the user's original input, 258 // the already-canonicalized host rather than using the user's original input,
259 // in case fixup affected the result here (e.g. an input that looks like an 259 // in case fixup affected the result here (e.g. an input that looks like an
260 // IPv4 address but with a non-empty desired TLD would return IPV4 before 260 // IPv4 address but with a non-empty desired TLD would return IPV4 before
261 // fixup and NEUTRAL afterwards, and we want to treat it as NEUTRAL). 261 // fixup and NEUTRAL afterwards, and we want to treat it as NEUTRAL).
262 url::CanonHostInfo host_info; 262 url::CanonHostInfo host_info;
263 net::CanonicalizeHost(canonicalized_url->host(), &host_info); 263 net::CanonicalizeHost(canonicalized_url->host(), &host_info);
264 264
265 // Check if the canonicalized host has a known TLD, which we'll want to know 265 // Check if the canonicalized host has a known TLD, which we'll want to know
266 // below. 266 // below.
267 const size_t registry_length = 267 const size_t registry_length =
268 net::registry_controlled_domains::GetRegistryLength( 268 net::registry_controlled_domains::GetCanonicalHostRegistryLength(
269 canonicalized_url->host(), 269 canonicalized_url->host(),
270 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, 270 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
271 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); 271 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
272 DCHECK_NE(std::string::npos, registry_length); 272 DCHECK_NE(std::string::npos, registry_length);
273 const bool has_known_tld = registry_length != 0; 273 const bool has_known_tld = registry_length != 0;
274 274
275 // See if the hostname is valid. While IE and GURL allow hostnames to contain 275 // See if the hostname is valid. While IE and GURL allow hostnames to contain
276 // many other characters (perhaps for weird intranet machines), it's extremely 276 // many other characters (perhaps for weird intranet machines), it's extremely
277 // unlikely that a user would be trying to type those in for anything other 277 // unlikely that a user would be trying to type those in for anything other
278 // than a search query. 278 // than a search query.
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 parts_ = url::Parsed(); 519 parts_ = url::Parsed();
520 scheme_.clear(); 520 scheme_.clear();
521 canonicalized_url_ = GURL(); 521 canonicalized_url_ = GURL();
522 prevent_inline_autocomplete_ = false; 522 prevent_inline_autocomplete_ = false;
523 prefer_keyword_ = false; 523 prefer_keyword_ = false;
524 allow_exact_keyword_match_ = false; 524 allow_exact_keyword_match_ = false;
525 want_asynchronous_matches_ = true; 525 want_asynchronous_matches_ = true;
526 from_omnibox_focus_ = false; 526 from_omnibox_focus_ = false;
527 terms_prefixed_by_http_or_https_.clear(); 527 terms_prefixed_by_http_or_https_.clear();
528 } 528 }
OLDNEW
« no previous file with comments | « components/history/core/browser/history_backend.cc ('k') | components/omnibox/browser/history_quick_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698