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_quick_provider.h" | 5 #include "components/omnibox/browser/history_quick_provider.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 HistoryURLProvider::kScoreForBestInlineableResult; | 134 HistoryURLProvider::kScoreForBestInlineableResult; |
135 } else if (url_db->IsTypedHost(host) && | 135 } else if (url_db->IsTypedHost(host) && |
136 (!autocomplete_input_.parts().path.is_nonempty() || | 136 (!autocomplete_input_.parts().path.is_nonempty() || |
137 ((autocomplete_input_.parts().path.len == 1) && | 137 ((autocomplete_input_.parts().path.len == 1) && |
138 (autocomplete_input_.text()[ | 138 (autocomplete_input_.text()[ |
139 autocomplete_input_.parts().path.begin] == '/'))) && | 139 autocomplete_input_.parts().path.begin] == '/'))) && |
140 !autocomplete_input_.parts().query.is_nonempty() && | 140 !autocomplete_input_.parts().query.is_nonempty() && |
141 !autocomplete_input_.parts().ref.is_nonempty()) { | 141 !autocomplete_input_.parts().ref.is_nonempty()) { |
142 // Not visited, but we've seen the host before. | 142 // Not visited, but we've seen the host before. |
143 will_have_url_what_you_typed_match_first = true; | 143 will_have_url_what_you_typed_match_first = true; |
144 if (net::registry_controlled_domains::HostHasRegistryControlledDomain( | 144 const size_t registry_length = |
| 145 net::registry_controlled_domains::GetRegistryLength( |
145 host, | 146 host, |
146 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, | 147 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, |
147 net::registry_controlled_domains:: | 148 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); |
148 EXCLUDE_PRIVATE_REGISTRIES)) { | 149 if (registry_length == 0) { |
149 // Known internet host. | 150 // Known intranet hosts get one score. |
| 151 url_what_you_typed_match_score = |
| 152 HistoryURLProvider::kScoreForUnvisitedIntranetResult; |
| 153 } else { |
| 154 // Known internet hosts get another. |
150 url_what_you_typed_match_score = | 155 url_what_you_typed_match_score = |
151 HistoryURLProvider::kScoreForWhatYouTypedResult; | 156 HistoryURLProvider::kScoreForWhatYouTypedResult; |
152 } else { | |
153 // An intranet host. | |
154 url_what_you_typed_match_score = | |
155 HistoryURLProvider::kScoreForUnvisitedIntranetResult; | |
156 } | 157 } |
157 } | 158 } |
158 } | 159 } |
159 } | 160 } |
160 } | 161 } |
161 | 162 |
162 // Loop over every result and add it to matches_. In the process, | 163 // Loop over every result and add it to matches_. In the process, |
163 // guarantee that scores are decreasing. |max_match_score| keeps | 164 // guarantee that scores are decreasing. |max_match_score| keeps |
164 // track of the highest score we can assign to any later results we | 165 // track of the highest score we can assign to any later results we |
165 // see. Also, reduce |max_match_score| if we think there will be | 166 // see. Also, reduce |max_match_score| if we think there will be |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 match.description = info.title(); | 247 match.description = info.title(); |
247 match.description_class = SpansFromTermMatch( | 248 match.description_class = SpansFromTermMatch( |
248 history_match.title_matches, match.description.length(), false); | 249 history_match.title_matches, match.description.length(), false); |
249 | 250 |
250 match.RecordAdditionalInfo("typed count", info.typed_count()); | 251 match.RecordAdditionalInfo("typed count", info.typed_count()); |
251 match.RecordAdditionalInfo("visit count", info.visit_count()); | 252 match.RecordAdditionalInfo("visit count", info.visit_count()); |
252 match.RecordAdditionalInfo("last visit", info.last_visit()); | 253 match.RecordAdditionalInfo("last visit", info.last_visit()); |
253 | 254 |
254 return match; | 255 return match; |
255 } | 256 } |
OLD | NEW |