summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/history_contents_provider.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 18:42:36 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-19 18:42:36 +0000
commit52d08b12e8e7ff7c9b865837a2aeb17fb9dc2d42 (patch)
treedaa03a7be2ffe72d304d7498b7b438ddb4469ae3 /chrome/browser/autocomplete/history_contents_provider.cc
parentc6d5cdb28856a33676e3bf40e213bddf204df9df (diff)
downloadchromium_src-52d08b12e8e7ff7c9b865837a2aeb17fb9dc2d42.zip
chromium_src-52d08b12e8e7ff7c9b865837a2aeb17fb9dc2d42.tar.gz
chromium_src-52d08b12e8e7ff7c9b865837a2aeb17fb9dc2d42.tar.bz2
Allow the history URL provider to handle input of type QUERY. This helps in the case where the user types something that on its own isn't navigable, but might be the prefix of something else navigable.
While there are no tests for this directly, another change of mine to treat more inputs with explicit schemes as queries (e.g. "http:/") relies on this, and does unittest for it. In order to fit the new relevance scores into the table, I went through and simplified the relevance scoring so that generally providers used the same scores for more input types. The effects of this should be barely noticeable (it affects the ranking of past search queries that are old against results from the secondary search provider), and it simplifies the code noticeably. This also fixes a "bug" that the NavSuggest results were incremented backwards, but since we only score one of these right now there's no visible effect. BUG=none TEST=none Review URL: http://codereview.chromium.org/291005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29428 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/history_contents_provider.cc')
-rw-r--r--chrome/browser/autocomplete/history_contents_provider.cc30
1 files changed, 5 insertions, 25 deletions
diff --git a/chrome/browser/autocomplete/history_contents_provider.cc b/chrome/browser/autocomplete/history_contents_provider.cc
index 558911c..d4d264e 100644
--- a/chrome/browser/autocomplete/history_contents_provider.cc
+++ b/chrome/browser/autocomplete/history_contents_provider.cc
@@ -250,31 +250,11 @@ void HistoryContentsProvider::ClassifyDescription(
int HistoryContentsProvider::CalculateRelevance(
const history::URLResult& result) {
const bool in_title = MatchInTitle(result);
- const bool is_starred =
- (profile_->GetBookmarkModel() &&
- profile_->GetBookmarkModel()->IsBookmarked(result.url()));
-
- switch (input_type_) {
- case AutocompleteInput::UNKNOWN:
- case AutocompleteInput::REQUESTED_URL:
- if (is_starred) {
- return in_title ?
- (1000 + star_title_count_++) : (550 + star_contents_count_++);
- }
- return in_title ? (700 + title_count_++) : (500 + contents_count_++);
-
- case AutocompleteInput::QUERY:
- case AutocompleteInput::FORCED_QUERY:
- if (is_starred) {
- return in_title ?
- (1200 + star_title_count_++) : (750 + star_contents_count_++);
- }
- return in_title ? (900 + title_count_++) : (700 + contents_count_++);
-
- default:
- NOTREACHED();
- return 0;
- }
+ if (!profile_->GetBookmarkModel() ||
+ !profile_->GetBookmarkModel()->IsBookmarked(result.url()))
+ return in_title ? (700 + title_count_++) : (500 + contents_count_++);
+ return in_title ?
+ (1000 + star_title_count_++) : (550 + star_contents_count_++);
}
void HistoryContentsProvider::QueryBookmarks(const AutocompleteInput& input) {