OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |