Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Side by Side Diff: components/omnibox/browser/history_quick_provider.cc

Issue 2433583002: Reduce buggy usage of the registry controlled domain service. (Closed)
Patch Set: Review comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 const size_t registry_length = 144 if (net::registry_controlled_domains::HostHasRegistryControlledDomain(
145 net::registry_controlled_domains::GetRegistryLength(
146 host, 145 host,
147 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, 146 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
148 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); 147 net::registry_controlled_domains::
149 if (registry_length == 0) { 148 EXCLUDE_PRIVATE_REGISTRIES)) {
150 // Known intranet hosts get one score. 149 // Known internet host.
150 url_what_you_typed_match_score =
151 HistoryURLProvider::kScoreForWhatYouTypedResult;
152 } else {
153 // An intranet host.
151 url_what_you_typed_match_score = 154 url_what_you_typed_match_score =
152 HistoryURLProvider::kScoreForUnvisitedIntranetResult; 155 HistoryURLProvider::kScoreForUnvisitedIntranetResult;
153 } else {
154 // Known internet hosts get another.
155 url_what_you_typed_match_score =
156 HistoryURLProvider::kScoreForWhatYouTypedResult;
157 } 156 }
158 } 157 }
159 } 158 }
160 } 159 }
161 } 160 }
162 161
163 // Loop over every result and add it to matches_. In the process, 162 // Loop over every result and add it to matches_. In the process,
164 // guarantee that scores are decreasing. |max_match_score| keeps 163 // guarantee that scores are decreasing. |max_match_score| keeps
165 // track of the highest score we can assign to any later results we 164 // track of the highest score we can assign to any later results we
166 // see. Also, reduce |max_match_score| if we think there will be 165 // see. Also, reduce |max_match_score| if we think there will be
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 match.description = info.title(); 246 match.description = info.title();
248 match.description_class = SpansFromTermMatch( 247 match.description_class = SpansFromTermMatch(
249 history_match.title_matches, match.description.length(), false); 248 history_match.title_matches, match.description.length(), false);
250 249
251 match.RecordAdditionalInfo("typed count", info.typed_count()); 250 match.RecordAdditionalInfo("typed count", info.typed_count());
252 match.RecordAdditionalInfo("visit count", info.visit_count()); 251 match.RecordAdditionalInfo("visit count", info.visit_count());
253 match.RecordAdditionalInfo("last visit", info.last_visit()); 252 match.RecordAdditionalInfo("last visit", info.last_visit());
254 253
255 return match; 254 return match;
256 } 255 }
OLDNEW
« no previous file with comments | « components/omnibox/browser/autocomplete_input.cc ('k') | components/omnibox/browser/history_url_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698