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

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

Issue 656363002: Type conversion fixes, components/ edition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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/autocomplete_input.h" 5 #include "components/omnibox/autocomplete_input.h"
6 6
7 #include "base/strings/string_util.h" 7 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "components/metrics/proto/omnibox_event.pb.h" 9 #include "components/metrics/proto/omnibox_event.pb.h"
10 #include "components/omnibox/autocomplete_scheme_classifier.h" 10 #include "components/omnibox/autocomplete_scheme_classifier.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 339
340 // Now that we've ruled out all schemes other than http or https and done a 340 // Now that we've ruled out all schemes other than http or https and done a
341 // little more sanity checking, the presence of a scheme means this is likely 341 // little more sanity checking, the presence of a scheme means this is likely
342 // a URL. 342 // a URL.
343 if (parts->scheme.is_nonempty()) 343 if (parts->scheme.is_nonempty())
344 return metrics::OmniboxInputType::URL; 344 return metrics::OmniboxInputType::URL;
345 345
346 // Trailing slashes force the input to be treated as a URL. 346 // Trailing slashes force the input to be treated as a URL.
347 if (parts->path.is_nonempty()) { 347 if (parts->path.is_nonempty()) {
348 char c = text[parts->path.end() - 1]; 348 base::char16 c = text[parts->path.end() - 1];
349 if ((c == '\\') || (c == '/')) 349 if ((c == '\\') || (c == '/'))
350 return metrics::OmniboxInputType::URL; 350 return metrics::OmniboxInputType::URL;
351 } 351 }
352 352
353 // Handle the cases we detected in the IPv4 code above as "almost certainly a 353 // Handle the cases we detected in the IPv4 code above as "almost certainly a
354 // query" now that we know the user hasn't tried to force navigation via a 354 // query" now that we know the user hasn't tried to force navigation via a
355 // scheme/trailing slash. 355 // scheme/trailing slash.
356 if ((host_info.family == url::CanonHostInfo::IPV4) && 356 if ((host_info.family == url::CanonHostInfo::IPV4) &&
357 (host_info.num_ipv4_components > 1)) 357 (host_info.num_ipv4_components > 1))
358 return metrics::OmniboxInputType::QUERY; 358 return metrics::OmniboxInputType::QUERY;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC; 512 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC;
513 type_ = metrics::OmniboxInputType::INVALID; 513 type_ = metrics::OmniboxInputType::INVALID;
514 parts_ = url::Parsed(); 514 parts_ = url::Parsed();
515 scheme_.clear(); 515 scheme_.clear();
516 canonicalized_url_ = GURL(); 516 canonicalized_url_ = GURL();
517 prevent_inline_autocomplete_ = false; 517 prevent_inline_autocomplete_ = false;
518 prefer_keyword_ = false; 518 prefer_keyword_ = false;
519 allow_exact_keyword_match_ = false; 519 allow_exact_keyword_match_ = false;
520 want_asynchronous_matches_ = true; 520 want_asynchronous_matches_ = true;
521 } 521 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698