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" |
11 #include "components/url_fixer/url_fixer.h" | 11 #include "components/url_fixer/url_fixer.h" |
| 12 #include "components/url_formatter/url_formatter.h" |
12 #include "net/base/net_util.h" | 13 #include "net/base/net_util.h" |
13 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 14 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
14 #include "url/url_canon_ip.h" | 15 #include "url/url_canon_ip.h" |
15 #include "url/url_util.h" | 16 #include "url/url_util.h" |
16 | 17 |
17 namespace { | 18 namespace { |
18 | 19 |
19 // Hardcode constant to avoid any dependencies on content/. | 20 // Hardcode constant to avoid any dependencies on content/. |
20 const char kViewSourceScheme[] = "view-source"; | 21 const char kViewSourceScheme[] = "view-source"; |
21 | 22 |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { | 462 parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { |
462 *host = parts.inner_parsed()->host; | 463 *host = parts.inner_parsed()->host; |
463 } | 464 } |
464 } | 465 } |
465 | 466 |
466 // static | 467 // static |
467 base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning( | 468 base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning( |
468 const GURL& url, | 469 const GURL& url, |
469 const base::string16& formatted_url, | 470 const base::string16& formatted_url, |
470 const AutocompleteSchemeClassifier& scheme_classifier) { | 471 const AutocompleteSchemeClassifier& scheme_classifier) { |
471 if (!net::CanStripTrailingSlash(url)) | 472 if (!url_formatter::CanStripTrailingSlash(url)) |
472 return formatted_url; | 473 return formatted_url; |
473 const base::string16 url_with_path(formatted_url + base::char16('/')); | 474 const base::string16 url_with_path(formatted_url + base::char16('/')); |
474 return (AutocompleteInput::Parse(formatted_url, std::string(), | 475 return (AutocompleteInput::Parse(formatted_url, std::string(), |
475 scheme_classifier, NULL, NULL, NULL) == | 476 scheme_classifier, NULL, NULL, NULL) == |
476 AutocompleteInput::Parse(url_with_path, std::string(), | 477 AutocompleteInput::Parse(url_with_path, std::string(), |
477 scheme_classifier, NULL, NULL, NULL)) ? | 478 scheme_classifier, NULL, NULL, NULL)) ? |
478 formatted_url : url_with_path; | 479 formatted_url : url_with_path; |
479 } | 480 } |
480 | 481 |
481 // static | 482 // static |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC; | 527 current_page_classification_ = metrics::OmniboxEventProto::INVALID_SPEC; |
527 type_ = metrics::OmniboxInputType::INVALID; | 528 type_ = metrics::OmniboxInputType::INVALID; |
528 parts_ = url::Parsed(); | 529 parts_ = url::Parsed(); |
529 scheme_.clear(); | 530 scheme_.clear(); |
530 canonicalized_url_ = GURL(); | 531 canonicalized_url_ = GURL(); |
531 prevent_inline_autocomplete_ = false; | 532 prevent_inline_autocomplete_ = false; |
532 prefer_keyword_ = false; | 533 prefer_keyword_ = false; |
533 allow_exact_keyword_match_ = false; | 534 allow_exact_keyword_match_ = false; |
534 want_asynchronous_matches_ = true; | 535 want_asynchronous_matches_ = true; |
535 } | 536 } |
OLD | NEW |