diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 14:09:18 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 14:09:18 +0000 |
commit | e17511f321a7914334a5054aeb71f31685052d5d (patch) | |
tree | 7c6964b46774a40cdb243344d53d1a5242e3011f /chrome | |
parent | d285689e1cfee56972fde797c9ef33becfed41bb (diff) | |
download | chromium_src-e17511f321a7914334a5054aeb71f31685052d5d.zip chromium_src-e17511f321a7914334a5054aeb71f31685052d5d.tar.gz chromium_src-e17511f321a7914334a5054aeb71f31685052d5d.tar.bz2 |
Makes past searches autocomplete when in keyword mode.
BUG=89160
TEST=do a search using a keyword, repeat and see that as you start typing after the keyword you get autocompleted
R=pkasting@chromium.org
Review URL: http://codereview.chromium.org/7330006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92360 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete.h | 1 | ||||
-rw-r--r-- | chrome/browser/autocomplete/search_provider.cc | 5 |
2 files changed, 4 insertions, 2 deletions
diff --git a/chrome/browser/autocomplete/autocomplete.h b/chrome/browser/autocomplete/autocomplete.h index ee73d69..1cbc3fc 100644 --- a/chrome/browser/autocomplete/autocomplete.h +++ b/chrome/browser/autocomplete/autocomplete.h @@ -112,6 +112,7 @@ // // QUERY input type: // --------------------------------------------------------------------|----- +// Search Primary or Secondary (past query in history within 2 days) | 1599** // Keyword (non-substituting or in keyword UI mode, exact match) | 1500 // Keyword (substituting, exact match) | 1450 // Extension App (exact match) | 1425 diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc index 706a091..88b8908 100644 --- a/chrome/browser/autocomplete/search_provider.cc +++ b/chrome/browser/autocomplete/search_provider.cc @@ -144,7 +144,7 @@ void SearchProvider::Start(const AutocompleteInput& input, default_provider = NULL; if (keyword_provider == default_provider) - keyword_provider = NULL; // No use in querying the same provider twice. + default_provider = NULL; // No use in querying the same provider twice. if (!default_provider && !keyword_provider) { // No valid providers. @@ -715,7 +715,7 @@ int SearchProvider::CalculateRelevanceForHistory(const Time& time, // Searches with the past two days get a different curve. const double autocomplete_time= 2 * 24 * 60 * 60; if (elapsed_time < autocomplete_time) { - return 1399 - static_cast<int>(99 * + return (is_keyword ? 1599 : 1399) - static_cast<int>(99 * std::pow(elapsed_time / autocomplete_time, 2.5)); } elapsed_time -= autocomplete_time; @@ -821,6 +821,7 @@ void SearchProvider::AddMatchToMap(const string16& query_string, if (is_keyword) { match.fill_into_edit.append( providers_.keyword_provider().keyword() + char16(' ')); + search_start += providers_.keyword_provider().keyword().size() + 1; } match.fill_into_edit.append(query_string); // Not all suggestions start with the original input. |