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

Side by Side Diff: chrome/browser/autocomplete/history_url_provider.cc

Issue 15140003: Add support for split Public Suffix List distinctions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased again Created 7 years, 7 months 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 | Annotate | Revision Log
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 "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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
788 // Normally passing the first two conditions below ought to guarantee the 788 // Normally passing the first two conditions below ought to guarantee the
789 // third condition, but because FixupUserInput() can run and modify the 789 // third condition, but because FixupUserInput() can run and modify the
790 // input's text and parts between Parse() and here, it seems better to be 790 // input's text and parts between Parse() and here, it seems better to be
791 // paranoid and check. 791 // paranoid and check.
792 if ((input.type() != AutocompleteInput::UNKNOWN) || 792 if ((input.type() != AutocompleteInput::UNKNOWN) ||
793 !LowerCaseEqualsASCII(input.scheme(), chrome::kHttpScheme) || 793 !LowerCaseEqualsASCII(input.scheme(), chrome::kHttpScheme) ||
794 !input.parts().host.is_nonempty()) 794 !input.parts().host.is_nonempty())
795 return false; 795 return false;
796 const std::string host(UTF16ToUTF8( 796 const std::string host(UTF16ToUTF8(
797 input.text().substr(input.parts().host.begin, input.parts().host.len))); 797 input.text().substr(input.parts().host.begin, input.parts().host.len)));
798 return (net::RegistryControlledDomainService::GetRegistryLength(host, 798 const size_t registry_length =
799 false) == 0) && db->IsTypedHost(host); 799 net::registry_controlled_domains::GetRegistryLength(
800 host,
801 net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES,
802 net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES);
803 return registry_length == 0 && db->IsTypedHost(host);
800 } 804 }
801 805
802 bool HistoryURLProvider::PromoteMatchForInlineAutocomplete( 806 bool HistoryURLProvider::PromoteMatchForInlineAutocomplete(
803 HistoryURLProviderParams* params, 807 HistoryURLProviderParams* params,
804 const history::HistoryMatch& match) { 808 const history::HistoryMatch& match) {
805 // Promote the first match if it's been typed at least n times, where n == 1 809 // Promote the first match if it's been typed at least n times, where n == 1
806 // for "simple" (host-only) URLs and n == 2 for others. We set a higher bar 810 // for "simple" (host-only) URLs and n == 2 for others. We set a higher bar
807 // for these long URLs because it's less likely that users will want to visit 811 // for these long URLs because it's less likely that users will want to visit
808 // them again. Even though we don't increment the typed_count for pasted-in 812 // them again. Even though we don't increment the typed_count for pasted-in
809 // URLs, if the user manually edits the URL or types some long thing in by 813 // URLs, if the user manually edits the URL or types some long thing in by
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 &match.contents_class); 1076 &match.contents_class);
1073 } 1077 }
1074 match.description = info.title(); 1078 match.description = info.title();
1075 AutocompleteMatch::ClassifyMatchInString(params->input.text(), 1079 AutocompleteMatch::ClassifyMatchInString(params->input.text(),
1076 info.title(), 1080 info.title(),
1077 ACMatchClassification::NONE, 1081 ACMatchClassification::NONE,
1078 &match.description_class); 1082 &match.description_class);
1079 RecordAdditionalInfoFromUrlRow(info, &match); 1083 RecordAdditionalInfoFromUrlRow(info, &match);
1080 return match; 1084 return match;
1081 } 1085 }
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_quick_provider.cc ('k') | chrome/browser/browsing_data/cookies_tree_model.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698