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