| 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 "components/omnibox/browser/history_url_provider.h" | 5 #include "components/omnibox/browser/history_url_provider.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 // Normally passing the first two conditions below ought to guarantee the | 975 // Normally passing the first two conditions below ought to guarantee the |
| 976 // third condition, but because FixupUserInput() can run and modify the | 976 // third condition, but because FixupUserInput() can run and modify the |
| 977 // input's text and parts between Parse() and here, it seems better to be | 977 // input's text and parts between Parse() and here, it seems better to be |
| 978 // paranoid and check. | 978 // paranoid and check. |
| 979 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || | 979 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || |
| 980 !base::LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || | 980 !base::LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || |
| 981 !input.parts().host.is_nonempty()) | 981 !input.parts().host.is_nonempty()) |
| 982 return false; | 982 return false; |
| 983 const std::string host(base::UTF16ToUTF8( | 983 const std::string host(base::UTF16ToUTF8( |
| 984 input.text().substr(input.parts().host.begin, input.parts().host.len))); | 984 input.text().substr(input.parts().host.begin, input.parts().host.len))); |
| 985 const size_t registry_length = | 985 const bool has_registry_domain = |
| 986 net::registry_controlled_domains::GetRegistryLength( | 986 net::registry_controlled_domains::HostHasRegistryControlledDomain( |
| 987 host, | 987 host, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 988 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | |
| 989 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 988 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 990 return registry_length == 0 && db->IsTypedHost(host); | 989 return !has_registry_domain && db->IsTypedHost(host); |
| 991 } | 990 } |
| 992 | 991 |
| 993 bool HistoryURLProvider::PromoteOrCreateShorterSuggestion( | 992 bool HistoryURLProvider::PromoteOrCreateShorterSuggestion( |
| 994 history::URLDatabase* db, | 993 history::URLDatabase* db, |
| 995 HistoryURLProviderParams* params) { | 994 HistoryURLProviderParams* params) { |
| 996 if (params->matches.empty()) | 995 if (params->matches.empty()) |
| 997 return false; // No matches, nothing to do. | 996 return false; // No matches, nothing to do. |
| 998 | 997 |
| 999 // Determine the base URL from which to search, and whether that URL could | 998 // Determine the base URL from which to search, and whether that URL could |
| 1000 // itself be added as a match. We can add the base iff it's not "effectively | 999 // itself be added as a match. We can add the base iff it's not "effectively |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1193 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1192 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
| 1194 match.contents.length(), ACMatchClassification::URL, | 1193 match.contents.length(), ACMatchClassification::URL, |
| 1195 &match.contents_class); | 1194 &match.contents_class); |
| 1196 } | 1195 } |
| 1197 match.description = info.title(); | 1196 match.description = info.title(); |
| 1198 match.description_class = | 1197 match.description_class = |
| 1199 ClassifyDescription(params.input.text(), match.description); | 1198 ClassifyDescription(params.input.text(), match.description); |
| 1200 RecordAdditionalInfoFromUrlRow(info, &match); | 1199 RecordAdditionalInfoFromUrlRow(info, &match); |
| 1201 return match; | 1200 return match; |
| 1202 } | 1201 } |
| OLD | NEW |