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 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 } | 966 } |
967 | 967 |
968 bool HistoryURLProvider::CanFindIntranetURL( | 968 bool HistoryURLProvider::CanFindIntranetURL( |
969 history::URLDatabase* db, | 969 history::URLDatabase* db, |
970 const AutocompleteInput& input) const { | 970 const AutocompleteInput& input) const { |
971 // Normally passing the first two conditions below ought to guarantee the | 971 // Normally passing the first two conditions below ought to guarantee the |
972 // third condition, but because FixupUserInput() can run and modify the | 972 // third condition, but because FixupUserInput() can run and modify the |
973 // input's text and parts between Parse() and here, it seems better to be | 973 // input's text and parts between Parse() and here, it seems better to be |
974 // paranoid and check. | 974 // paranoid and check. |
975 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || | 975 if ((input.type() != metrics::OmniboxInputType::UNKNOWN) || |
976 !base::LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || | 976 !LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || |
977 !input.parts().host.is_nonempty()) | 977 !input.parts().host.is_nonempty()) |
978 return false; | 978 return false; |
979 const std::string host(base::UTF16ToUTF8( | 979 const std::string host(base::UTF16ToUTF8( |
980 input.text().substr(input.parts().host.begin, input.parts().host.len))); | 980 input.text().substr(input.parts().host.begin, input.parts().host.len))); |
981 const size_t registry_length = | 981 const size_t registry_length = |
982 net::registry_controlled_domains::GetRegistryLength( | 982 net::registry_controlled_domains::GetRegistryLength( |
983 host, | 983 host, |
984 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 984 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
985 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 985 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
986 return registry_length == 0 && db->IsTypedHost(host); | 986 return registry_length == 0 && db->IsTypedHost(host); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1185 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, | 1185 AutocompleteMatch::ClassifyLocationInString(base::string16::npos, 0, |
1186 match.contents.length(), ACMatchClassification::URL, | 1186 match.contents.length(), ACMatchClassification::URL, |
1187 &match.contents_class); | 1187 &match.contents_class); |
1188 } | 1188 } |
1189 match.description = info.title(); | 1189 match.description = info.title(); |
1190 match.description_class = | 1190 match.description_class = |
1191 ClassifyDescription(params.input.text(), match.description); | 1191 ClassifyDescription(params.input.text(), match.description); |
1192 RecordAdditionalInfoFromUrlRow(info, &match); | 1192 RecordAdditionalInfoFromUrlRow(info, &match); |
1193 return match; | 1193 return match; |
1194 } | 1194 } |
OLD | NEW |