summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete
diff options
context:
space:
mode:
authorisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 23:00:19 +0000
committerisherman@chromium.org <isherman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 23:00:19 +0000
commit681d27566707595006c468b17c27f8341d176b45 (patch)
treebaf9abff5deaddafdbcfcd56859093d17e3fc6b5 /chrome/browser/autocomplete
parenta83d4229743f26512b24b9b3f0eb0ea871bb41d7 (diff)
downloadchromium_src-681d27566707595006c468b17c27f8341d176b45.zip
chromium_src-681d27566707595006c468b17c27f8341d176b45.tar.gz
chromium_src-681d27566707595006c468b17c27f8341d176b45.tar.bz2
Disable autocomplete for search keywords.
We have custom UI for search keywords anyway, so in practice a user would never see the autocompleted url. But, we had been computing the index incorrectly in some cases, as we trim off "http://" and "www." to compute the keyword. Since we don't use it anyway, simplify the logic and get rid of it :) BUG=none TEST=none Review URL: http://codereview.chromium.org/3151020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56445 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete')
-rw-r--r--chrome/browser/autocomplete/keyword_provider.cc11
-rw-r--r--chrome/browser/autocomplete/keyword_provider.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index 1e68de5..4238a89 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -339,7 +339,7 @@ int KeywordProvider::CalculateRelevance(AutocompleteInput::Type type,
AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
TemplateURLModel* model,
- const std::wstring keyword,
+ const std::wstring& keyword,
const AutocompleteInput& input,
size_t prefix_length,
const std::wstring& remaining_input,
@@ -369,9 +369,12 @@ AutocompleteMatch KeywordProvider::CreateAutocompleteMatch(
if (!remaining_input.empty() || !keyword_complete || supports_replacement)
result.fill_into_edit.push_back(L' ');
result.fill_into_edit.append(remaining_input);
- if (!input.prevent_inline_autocomplete() &&
- (keyword_complete || remaining_input.empty()))
- result.inline_autocomplete_offset = input.text().length();
+ // If we wanted to set |result.inline_autocomplete_offset| correctly, we'd
+ // need CleanUserInputKeyword() to return the amount of adjustment it's made
+ // to the user's input. Because right now inexact keyword matches can't score
+ // more highly than a "what you typed" match from one of the other providers,
+ // we just don't bother to do this, and leave inline autocompletion off.
+ result.inline_autocomplete_offset = std::wstring::npos;
// Create destination URL and popup entry content by substituting user input
// into keyword templates.
diff --git a/chrome/browser/autocomplete/keyword_provider.h b/chrome/browser/autocomplete/keyword_provider.h
index 9f7de95..056d47b 100644
--- a/chrome/browser/autocomplete/keyword_provider.h
+++ b/chrome/browser/autocomplete/keyword_provider.h
@@ -112,7 +112,7 @@ class KeywordProvider : public AutocompleteProvider,
// If |relevance| is negative, calculate a relevance based on heuristics.
AutocompleteMatch CreateAutocompleteMatch(
TemplateURLModel* model,
- const std::wstring keyword,
+ const std::wstring& keyword,
const AutocompleteInput& input,
size_t prefix_length,
const std::wstring& remaining_input,