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

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: finish converting AddToMap() calls 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 keywords). If
71 // |allow_exact_keyword_match| is false, the relevance for complete
72 // keywords that support replacements is degraded.
73 static int CalculateRelevanceForKeywordVerbatim(
74 metrics::OmniboxInputType::Type type,
75 bool allow_exact_keyword_match,
76 bool prefer_keyword);
77
69 // AutocompleteProvider: 78 // AutocompleteProvider:
70 void ResetSession() override; 79 void ResetSession() override;
71 80
72 protected: 81 protected:
73 ~SearchProvider() override; 82 ~SearchProvider() override;
74 83
75 private: 84 private:
76 friend class AutocompleteProviderTest; 85 friend class AutocompleteProviderTest;
77 friend class SearchProviderTest; 86 friend class SearchProviderTest;
78 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL); 87 FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, CanSendURL);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 base::string16 default_provider_; 144 base::string16 default_provider_;
136 base::string16 keyword_provider_; 145 base::string16 keyword_provider_;
137 146
138 DISALLOW_COPY_AND_ASSIGN(Providers); 147 DISALLOW_COPY_AND_ASSIGN(Providers);
139 }; 148 };
140 149
141 class CompareScoredResults; 150 class CompareScoredResults;
142 151
143 typedef std::vector<history::KeywordSearchTermVisit> HistoryResults; 152 typedef std::vector<history::KeywordSearchTermVisit> HistoryResults;
144 153
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(). 154 // A helper function for UpdateAllOldResults().
152 static void UpdateOldResults(bool minimal_changes, 155 static void UpdateOldResults(bool minimal_changes,
153 SearchSuggestionParser::Results* results); 156 SearchSuggestionParser::Results* results);
154 157
155 // Returns the first match in |matches| which might be chosen as default. 158 // Returns the first match in |matches| which might be chosen as default.
156 static ACMatches::iterator FindTopMatch(ACMatches* matches); 159 static ACMatches::iterator FindTopMatch(ACMatches* matches);
157 160
158 // AutocompleteProvider: 161 // AutocompleteProvider:
159 void Start(const AutocompleteInput& input, bool minimal_changes) override; 162 void Start(const AutocompleteInput& input, bool minimal_changes) override;
160 void Stop(bool clear_cached_results, 163 void Stop(bool clear_cached_results,
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 base::TimeTicks token_expiration_time_; 407 base::TimeTicks token_expiration_time_;
405 408
406 // Answers prefetch management. 409 // Answers prefetch management.
407 AnswersCache answers_cache_; // Cache for last answers seen. 410 AnswersCache answers_cache_; // Cache for last answers seen.
408 AnswersQueryData prefetch_data_; // Data to use for query prefetching. 411 AnswersQueryData prefetch_data_; // Data to use for query prefetching.
409 412
410 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 413 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
411 }; 414 };
412 415
413 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_PROVIDER_H_ 416 #endif // COMPONENTS_OMNIBOX_BROWSER_SEARCH_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698