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

Side by Side Diff: components/omnibox/browser/search_provider.h

Issue 1411543011: Omnibox: Make Keyword Provide More Generous with Matching (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: almost all of peter's comments Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // This file contains the Search autocomplete provider. This provider is 5 // This file contains the Search autocomplete provider. This provider is
6 // responsible for all autocomplete entries that start with "Search <engine> 6 // responsible for all autocomplete entries that start with "Search <engine>
7 // for ...", including searching for the current input string, search 7 // for ...", including searching for the current input string, search
8 // history, and search suggestions. An instance of it gets created and 8 // history, and search suggestions. An instance of it gets created and
9 // managed by the autocomplete controller. 9 // managed by the autocomplete controller.
10 10
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 AutocompleteProviderListener* listener); 59 AutocompleteProviderListener* listener);
60 60
61 // Extracts the suggest response metadata which SearchProvider previously 61 // Extracts the suggest response metadata which SearchProvider previously
62 // stored for |match|. 62 // stored for |match|.
63 static std::string GetSuggestMetadata(const AutocompleteMatch& match); 63 static std::string GetSuggestMetadata(const AutocompleteMatch& match);
64 64
65 // Answers prefetch handling - register displayed answers. Takes the top 65 // Answers prefetch handling - register displayed answers. Takes the top
66 // match for Autocomplete and registers the contained answer data, if any. 66 // match for Autocomplete and registers the contained answer data, if any.
67 void RegisterDisplayedAnswers(const AutocompleteResult& result); 67 void RegisterDisplayedAnswers(const AutocompleteResult& result);
68 68
69 // Calculates the relevance score for the keyword verbatim result (if the
70 // input matches one of the profile's keyword).
Peter Kasting 2015/11/12 20:36:10 Nit: keyword -> keywords
Mark P 2015/11/12 21:42:48 Done.
71 static int CalculateRelevanceForKeywordVerbatim(
72 metrics::OmniboxInputType::Type type,
73 bool allow_exact_keyword_match,
Peter Kasting 2015/11/12 20:36:10 Nit: Add comments about what this arg means.
Mark P 2015/11/12 21:42:48 Done.
74 bool prefer_keyword);
75
69 // AutocompleteProvider: 76 // AutocompleteProvider:
70 void ResetSession() override; 77 void ResetSession() override;
71 78
72 protected: 79 protected:
73 ~SearchProvider() override; 80 ~SearchProvider() override;
74 81
75 private: 82 private:
76 friend class AutocompleteProviderTest; 83 friend class AutocompleteProviderTest;
77 friend class SearchProviderTest; 84 friend class SearchProviderTest;
78 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); 85 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::string16 default_provider_; 142 base::string16 default_provider_;
136 base::string16 keyword_provider_; 143 base::string16 keyword_provider_;
137 144
138 DISALLOW_COPY_AND_ASSIGN(Providers); 145 DISALLOW_COPY_AND_ASSIGN(Providers);
139 }; 146 };
140 147
141 class CompareScoredResults; 148 class CompareScoredResults;
142 149
143 typedef std::vector<history::KeywordSearchTermVisit> HistoryResults; 150 typedef std::vector<history::KeywordSearchTermVisit> HistoryResults;
144 151
145 // Calculates the relevance score for the keyword verbatim result (if the
146 // input matches one of the profile's keyword).
147 static int CalculateRelevanceForKeywordVerbatim(
148 metrics::OmniboxInputType::Type type,
149 bool prefer_keyword);
150
151 // A helper function for UpdateAllOldResults(). 152 // A helper function for UpdateAllOldResults().
152 static void UpdateOldResults(bool minimal_changes, 153 static void UpdateOldResults(bool minimal_changes,
153 SearchSuggestionParser::Results* results); 154 SearchSuggestionParser::Results* results);
154 155
155 // Returns the first match in |matches| which might be chosen as default. 156 // Returns the first match in |matches| which might be chosen as default.
156 static ACMatches::iterator FindTopMatch(ACMatches* matches); 157 static ACMatches::iterator FindTopMatch(ACMatches* matches);
157 158
158 // AutocompleteProvider: 159 // AutocompleteProvider:
159 void Start(const AutocompleteInput& input, bool minimal_changes) override; 160 void Start(const AutocompleteInput& input, bool minimal_changes) override;
160 void Stop(bool clear_cached_results, 161 void Stop(bool clear_cached_results,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 base::TimeTicks token_expiration_time_; 405 base::TimeTicks token_expiration_time_;
405 406
406 // Answers prefetch management. 407 // Answers prefetch management.
407 AnswersCache answers_cache_; // Cache for last answers seen. 408 AnswersCache answers_cache_; // Cache for last answers seen.
408 AnswersQueryData prefetch_data_; // Data to use for query prefetching. 409 AnswersQueryData prefetch_data_; // Data to use for query prefetching.
409 410
410 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 411 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
411 }; 412 };
412 413
413 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_PROVIDER_H_ 414 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698