| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/autocomplete/autocomplete_input.h" | 5 #include "chrome/browser/autocomplete/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 "chrome/browser/external_protocol/external_protocol_handler.h" | 9 #include "chrome/browser/external_protocol/external_protocol_handler.h" |
| 10 #include "chrome/browser/profiles/profile_io_data.h" | 10 #include "chrome/browser/profiles/profile_io_data.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 UTF16ToUTF8(desired_tld)); | 153 UTF16ToUTF8(desired_tld)); |
| 154 } | 154 } |
| 155 | 155 |
| 156 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileScheme)) { | 156 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileScheme)) { |
| 157 // A user might or might not type a scheme when entering a file URL. In | 157 // A user might or might not type a scheme when entering a file URL. In |
| 158 // either case, |parsed_scheme| will tell us that this is a file URL, but | 158 // either case, |parsed_scheme| will tell us that this is a file URL, but |
| 159 // |parts->scheme| might be empty, e.g. if the user typed "C:\foo". | 159 // |parts->scheme| might be empty, e.g. if the user typed "C:\foo". |
| 160 return URL; | 160 return URL; |
| 161 } | 161 } |
| 162 | 162 |
| 163 if (LowerCaseEqualsASCII(parsed_scheme, chrome::kFileSystemScheme)) { | 163 if (LowerCaseEqualsASCII(parsed_scheme, content::kFileSystemScheme)) { |
| 164 // This could theoretically be a strange search, but let's check. | 164 // This could theoretically be a strange search, but let's check. |
| 165 // If it's got an inner_url with a scheme, it's a URL, whether it's valid or | 165 // If it's got an inner_url with a scheme, it's a URL, whether it's valid or |
| 166 // not. | 166 // not. |
| 167 if (parts->inner_parsed() && parts->inner_parsed()->scheme.is_valid()) | 167 if (parts->inner_parsed() && parts->inner_parsed()->scheme.is_valid()) |
| 168 return URL; | 168 return URL; |
| 169 } | 169 } |
| 170 | 170 |
| 171 // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it | 171 // If the user typed a scheme, and it's HTTP or HTTPS, we know how to parse it |
| 172 // well enough that we can fall through to the heuristics below. If it's | 172 // well enough that we can fall through to the heuristics below. If it's |
| 173 // something else, we can just determine our action based on what we do with | 173 // something else, we can just determine our action based on what we do with |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 scheme->reset(); | 453 scheme->reset(); |
| 454 } | 454 } |
| 455 if (real_parts.host.is_nonempty()) { | 455 if (real_parts.host.is_nonempty()) { |
| 456 *host = url_parse::Component( | 456 *host = url_parse::Component( |
| 457 after_scheme_and_colon + real_parts.host.begin, | 457 after_scheme_and_colon + real_parts.host.begin, |
| 458 real_parts.host.len); | 458 real_parts.host.len); |
| 459 } else { | 459 } else { |
| 460 host->reset(); | 460 host->reset(); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 } else if (LowerCaseEqualsASCII(scheme_str, chrome::kFileSystemScheme) && | 463 } else if (LowerCaseEqualsASCII(scheme_str, content::kFileSystemScheme) && |
| 464 parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { | 464 parts.inner_parsed() && parts.inner_parsed()->scheme.is_valid()) { |
| 465 *host = parts.inner_parsed()->host; | 465 *host = parts.inner_parsed()->host; |
| 466 } | 466 } |
| 467 } | 467 } |
| 468 | 468 |
| 469 // static | 469 // static |
| 470 base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning( | 470 base::string16 AutocompleteInput::FormattedStringWithEquivalentMeaning( |
| 471 const GURL& url, | 471 const GURL& url, |
| 472 const base::string16& formatted_url) { | 472 const base::string16& formatted_url) { |
| 473 if (!net::CanStripTrailingSlash(url)) | 473 if (!net::CanStripTrailingSlash(url)) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 current_page_classification_ = AutocompleteInput::INVALID_SPEC; | 528 current_page_classification_ = AutocompleteInput::INVALID_SPEC; |
| 529 type_ = INVALID; | 529 type_ = INVALID; |
| 530 parts_ = url_parse::Parsed(); | 530 parts_ = url_parse::Parsed(); |
| 531 scheme_.clear(); | 531 scheme_.clear(); |
| 532 canonicalized_url_ = GURL(); | 532 canonicalized_url_ = GURL(); |
| 533 prevent_inline_autocomplete_ = false; | 533 prevent_inline_autocomplete_ = false; |
| 534 prefer_keyword_ = false; | 534 prefer_keyword_ = false; |
| 535 allow_exact_keyword_match_ = false; | 535 allow_exact_keyword_match_ = false; |
| 536 matches_requested_ = ALL_MATCHES; | 536 matches_requested_ = ALL_MATCHES; |
| 537 } | 537 } |
| OLD | NEW |