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

Unified Diff: chrome/browser/autocomplete/search_provider.h

Issue 10274023: Omnibox SearchProvider Experiment Client Implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Working to some degree... Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/autocomplete/search_provider.h
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index 0914101646acc08d5d16ffd5b84b2b24e6f0c44c..8ccf5ad6c18a60e6079ec0565361f2498ad99185 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -158,20 +158,31 @@ class SearchProvider : public AutocompleteProvider,
DISALLOW_COPY_AND_ASSIGN(Providers);
};
+ struct SuggestResult {
+ SuggestResult(const string16& suggestion,
+ bool has_suggested_relevance,
+ int relevance);
+
+ string16 suggestion;
+
+ bool has_suggested_relevance;
+ int relevance;
+ };
+
struct NavigationResult {
- NavigationResult(const GURL& url, const string16& site_name)
- : url(url),
- site_name(site_name) {
- }
+ NavigationResult(const GURL& url,
+ const string16& site_name,
+ bool has_suggested_relevance,
+ int relevance);
- // The URL.
GURL url;
-
- // Name for the site.
string16 site_name;
+
+ bool has_suggested_relevance;
+ int relevance;
};
- typedef std::vector<string16> SuggestResults;
+ typedef std::vector<SuggestResult> SuggestResults;
typedef std::vector<NavigationResult> NavigationResults;
typedef std::vector<history::KeywordSearchTermVisit> HistoryResults;
typedef std::map<string16, AutocompleteMatch> MatchMap;
@@ -201,6 +212,9 @@ class SearchProvider : public AutocompleteProvider,
// NOTE: This does not update |done_|. Callers must do so.
void StopSuggest();
+ // Clears the current results.
+ void ClearResults();
+
// Creates a URLFetcher requesting suggest results from the specified
// |suggestions_url|. The caller owns the returned URLFetcher.
content::URLFetcher* CreateSuggestFetcher(
@@ -261,12 +275,12 @@ class SearchProvider : public AutocompleteProvider,
// |result_number| is the index of the suggestion in the result set from the
// server; the best suggestion is suggestion number 0. |is_keyword| is true
// if the search is from the keyword provider.
- int CalculateRelevanceForSuggestion(size_t num_results,
+ int CalculateRelevanceForSuggestion(const SuggestResults& results,
size_t result_number,
bool is_keyword) const;
// |result_number| is same as above. |is_keyword| is true if the navigation
// result was suggested by the keyword provider.
- int CalculateRelevanceForNavigation(size_t num_results,
+ int CalculateRelevanceForNavigation(const NavigationResults& results,
size_t result_number,
bool is_keyword) const;
@@ -300,6 +314,10 @@ class SearchProvider : public AutocompleteProvider,
// The user's input.
AutocompleteInput input_;
+ // The suggested verbatim relevance for SEARCH_WHAT_YOU_TYPED.
+ bool has_verbatim_relevance_;
+ int verbatim_relevance_;
+
// Input text when searching against the keyword provider.
string16 keyword_input_text_;

Powered by Google App Engine
This is Rietveld 408576698