summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/search_provider.cc
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-13 00:19:00 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-13 00:19:00 +0000
commit4c1fb7ec9e85150afcbc7f3e0c2cbe788e31e9de (patch)
tree114c7194a922ef8c6dfdea7ebbc38f41abf8588a /chrome/browser/autocomplete/search_provider.cc
parentd7cbf44926f66dde008ef8a6b8141ec8a774692c (diff)
downloadchromium_src-4c1fb7ec9e85150afcbc7f3e0c2cbe788e31e9de.zip
chromium_src-4c1fb7ec9e85150afcbc7f3e0c2cbe788e31e9de.tar.gz
chromium_src-4c1fb7ec9e85150afcbc7f3e0c2cbe788e31e9de.tar.bz2
Omnibox metrics logging patch splitout, part 5: Add additional AutocompleteMatch types, and pass a type to the AutocompleteMatch constructor. The added detail in the new types is not used for anything functional; its sole purpose is for metric logging. Someday we could probably update other bits of the code to make use of this, though (e.g. the paste-and-search vs. paste-and-go determinant code).
These are separable changes, but doing either one without the other would have required an annoying number of fragile temporary changes. Review URL: http://codereview.chromium.org/10855 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/search_provider.cc')
-rw-r--r--chrome/browser/autocomplete/search_provider.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index 2a2ec53..47ccdd8 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -61,7 +61,8 @@ void SearchProvider::Start(const AutocompleteInput& input,
if (input.text().empty()) {
// User typed "?" alone. Give them a placeholder result indicating what
// this syntax does.
- AutocompleteMatch match(this, 0, false);
+ AutocompleteMatch match(this, 0, false,
+ AutocompleteMatch::SEARCH_WHAT_YOU_TYPED);
static const std::wstring kNoQueryInput(
l10n_util::GetString(IDS_AUTOCOMPLETE_NO_QUERY));
match.contents.assign(l10n_util::GetStringF(
@@ -69,7 +70,6 @@ void SearchProvider::Start(const AutocompleteInput& input,
kNoQueryInput));
match.contents_class.push_back(
ACMatchClassification(0, ACMatchClassification::DIM));
- match.type = AutocompleteMatch::SEARCH;
matches_.push_back(match);
Stop();
return;
@@ -342,16 +342,19 @@ void SearchProvider::ConvertResultsToAutocompleteMatches() {
TemplateURLRef::NO_SUGGESTION_CHOSEN;
const Time no_time;
AddMatchToMap(input_.text(), CalculateRelevanceForWhatYouTyped(),
+ AutocompleteMatch::SEARCH_WHAT_YOU_TYPED,
did_not_accept_suggestion, &map);
for (HistoryResults::const_iterator i(history_results_.begin());
i != history_results_.end(); ++i) {
AddMatchToMap(i->term, CalculateRelevanceForHistory(i->time),
- did_not_accept_suggestion, &map);
+ AutocompleteMatch::SEARCH_HISTORY, did_not_accept_suggestion,
+ &map);
}
for (size_t i = 0; i < suggest_results_.size(); ++i) {
AddMatchToMap(suggest_results_[i], CalculateRelevanceForSuggestion(i),
+ AutocompleteMatch::SEARCH_SUGGEST,
static_cast<int>(i), &map);
}
@@ -485,10 +488,10 @@ int SearchProvider::CalculateRelevanceForNavigation(
void SearchProvider::AddMatchToMap(const std::wstring& query_string,
int relevance,
+ AutocompleteMatch::Type type,
int accepted_suggestion,
MatchMap* map) {
- AutocompleteMatch match(this, relevance, false);
- match.type = AutocompleteMatch::SEARCH;
+ AutocompleteMatch match(this, relevance, false, type);
std::vector<size_t> content_param_offsets;
match.contents.assign(l10n_util::GetStringF(IDS_AUTOCOMPLETE_SEARCH_CONTENTS,
default_provider_.short_name(),
@@ -559,7 +562,8 @@ void SearchProvider::AddMatchToMap(const std::wstring& query_string,
AutocompleteMatch SearchProvider::NavigationToMatch(
const NavigationResult& navigation,
int relevance) {
- AutocompleteMatch match(this, relevance, false);
+ AutocompleteMatch match(this, relevance, false,
+ AutocompleteMatch::NAVSUGGEST);
match.destination_url = navigation.url;
match.contents = StringForURLDisplay(GURL(navigation.url), true);
// TODO(kochi): Consider moving HistoryURLProvider::TrimHttpPrefix() to some