| 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 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 } | 855 } |
| 856 | 856 |
| 857 bool HistoryURLProvider::CanFindIntranetURL( | 857 bool HistoryURLProvider::CanFindIntranetURL( |
| 858 history::URLDatabase* db, | 858 history::URLDatabase* db, |
| 859 const AutocompleteInput& input) const { | 859 const AutocompleteInput& input) const { |
| 860 // Normally passing the first two conditions below ought to guarantee the | 860 // Normally passing the first two conditions below ought to guarantee the |
| 861 // third condition, but because FixupUserInput() can run and modify the | 861 // third condition, but because FixupUserInput() can run and modify the |
| 862 // input's text and parts between Parse() and here, it seems better to be | 862 // input's text and parts between Parse() and here, it seems better to be |
| 863 // paranoid and check. | 863 // paranoid and check. |
| 864 if ((input.type() != AutocompleteInput::UNKNOWN) || | 864 if ((input.type() != AutocompleteInput::UNKNOWN) || |
| 865 !LowerCaseEqualsASCII(input.scheme(), content::kHttpScheme) || | 865 !LowerCaseEqualsASCII(input.scheme(), url::kHttpScheme) || |
| 866 !input.parts().host.is_nonempty()) | 866 !input.parts().host.is_nonempty()) |
| 867 return false; | 867 return false; |
| 868 const std::string host(base::UTF16ToUTF8( | 868 const std::string host(base::UTF16ToUTF8( |
| 869 input.text().substr(input.parts().host.begin, input.parts().host.len))); | 869 input.text().substr(input.parts().host.begin, input.parts().host.len))); |
| 870 const size_t registry_length = | 870 const size_t registry_length = |
| 871 net::registry_controlled_domains::GetRegistryLength( | 871 net::registry_controlled_domains::GetRegistryLength( |
| 872 host, | 872 host, |
| 873 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 873 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
| 874 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); | 874 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
| 875 return registry_length == 0 && db->IsTypedHost(host); | 875 return registry_length == 0 && db->IsTypedHost(host); |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1158 // If HistoryURL retrieves any matches (and hence we reach this code), we | 1158 // If HistoryURL retrieves any matches (and hence we reach this code), we |
| 1159 // are guaranteed that the beginning of input_text must be a word break. | 1159 // are guaranteed that the beginning of input_text must be a word break. |
| 1160 history::WordStarts offsets(1, 0u); | 1160 history::WordStarts offsets(1, 0u); |
| 1161 description_matches = | 1161 description_matches = |
| 1162 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( | 1162 history::ScoredHistoryMatch::FilterTermMatchesByWordStarts( |
| 1163 description_matches, offsets, description_word_starts, 0, | 1163 description_matches, offsets, description_word_starts, 0, |
| 1164 std::string::npos); | 1164 std::string::npos); |
| 1165 return SpansFromTermMatch( | 1165 return SpansFromTermMatch( |
| 1166 description_matches, clean_description.length(), false); | 1166 description_matches, clean_description.length(), false); |
| 1167 } | 1167 } |
| OLD | NEW |