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/history_url_provider.h" | 5 #include "chrome/browser/autocomplete/history_url_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 } | 961 } |
962 | 962 |
963 bool HistoryURLProvider::CanFindIntranetURL( | 963 bool HistoryURLProvider::CanFindIntranetURL( |
964 history::URLDatabase* db, | 964 history::URLDatabase* db, |
965 const AutocompleteInput& input) const { | 965 const AutocompleteInput& input) const { |
966 // Normally passing the first two conditions below ought to guarantee the | 966 // Normally passing the first two conditions below ought to guarantee the |
967 // third condition, but because FixupUserInput() can run and modify the | 967 // third condition, but because FixupUserInput() can run and modify the |
968 // input's text and parts between Parse() and here, it seems better to be | 968 // input's text and parts between Parse() and here, it seems better to be |
969 // paranoid and check. | 969 // paranoid and check. |
970 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || | 970 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || |
971 !LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || | 971 !base::LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || |
972 !input.parts().host.is_nonempty()) | 972 !input.parts().host.is_nonempty()) |
973 return false; | 973 return false; |
974 const std::string host(base::UTF16ToUTF8( | 974 const std::string host(base::UTF16ToUTF8( |
975 input.text().substr(input.parts().host.begin, input.parts().host.len))); | 975 input.text().substr(input.parts().host.begin, input.parts().host.len))); |
976 const size_t registry_length = | 976 const size_t registry_length = |
977 net::registry_controlled_domains::GetRegistryLength( | 977 net::registry_controlled_domains::GetRegistryLength( |
978 host, | 978 host, |
979 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 979 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
980 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 980 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
981 return registry_length == 0 && db->IsTypedHost(host); | 981 return registry_length == 0 && db->IsTypedHost(host); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1179 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1179 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
1180 match.contents.length(), ACMatchClassification::URL, | 1180 match.contents.length(), ACMatchClassification::URL, |
1181 &match.contents_class); | 1181 &match.contents_class); |
1182 } | 1182 } |
1183 match.description = info.title(); | 1183 match.description = info.title(); |
1184 match.description_class = | 1184 match.description_class = |
1185 ClassifyDescription(params.input.text(), match.description); | 1185 ClassifyDescription(params.input.text(), match.description); |
1186 RecordAdditionalInfoFromUrlRow(info, &match); | 1186 RecordAdditionalInfoFromUrlRow(info, &match); |
1187 return match; | 1187 return match; |
1188 } | 1188 } |
OLD | NEW |