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

Side by Side Diff: chrome/browser/autocomplete/search_provider.h

Issue 12090006: Omnibox: Create Keyword Verbatim Result in Search Provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: roperly resolved (variable rename) Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
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 non-keyword autocomplete entries that start with 6 // responsible for all autocomplete entries that start with "Search <engine>
7 // "Search <engine> for ...", including searching for the current input string, 7 // for ...", including searching for the current input string, search
8 // search 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
11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
12 #define CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 12 #define CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
13 13
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 bool input_multiple_words, 281 bool input_multiple_words,
282 const string16& input_text, 282 const string16& input_text,
283 bool is_keyword); 283 bool is_keyword);
284 284
285 // Adds matches for |results| to |map|. |is_keyword| indicates whether the 285 // Adds matches for |results| to |map|. |is_keyword| indicates whether the
286 // results correspond to the keyword provider or default provider. 286 // results correspond to the keyword provider or default provider.
287 void AddSuggestResultsToMap(const SuggestResults& results, 287 void AddSuggestResultsToMap(const SuggestResults& results,
288 bool is_keyword, 288 bool is_keyword,
289 MatchMap* map); 289 MatchMap* map);
290 290
291 // Get the relevance score for the verbatim result; this value may be provided 291 // Gets the relevance score for the verbatim result; this value may be
292 // by the suggest server; otherwise it is calculated locally. 292 // provided by the suggest server; otherwise it is calculated locally.
293 int GetVerbatimRelevance() const; 293 int GetVerbatimRelevance() const;
294 // Calculate the relevance score for the verbatim result. 294 // Calculates the relevance score for the verbatim result.
295 int CalculateRelevanceForVerbatim() const; 295 int CalculateRelevanceForVerbatim() const;
296 // Calculates the relevance score for the keyword verbatim result (if the
297 // input matches one of the profile's keyword).
298 static int CalculateRelevanceForKeywordVerbatim(AutocompleteInput::Type type,
299 bool prefer_keyword);
296 // |time| is the time at which this query was last seen. |is_keyword| 300 // |time| is the time at which this query was last seen. |is_keyword|
297 // indicates whether the results correspond to the keyword provider or default 301 // indicates whether the results correspond to the keyword provider or default
298 // provider. |prevent_inline_autocomplete| is true if we should not inline 302 // provider. |prevent_inline_autocomplete| is true if we should not inline
299 // autocomplete this query. 303 // autocomplete this query.
300 int CalculateRelevanceForHistory(const base::Time& time, 304 int CalculateRelevanceForHistory(const base::Time& time,
301 bool is_keyword, 305 bool is_keyword,
302 bool prevent_inline_autocomplete) const; 306 bool prevent_inline_autocomplete) const;
303 // Calculate the relevance for search suggestion results. Set |for_keyword| to 307 // Calculates the relevance for search suggestion results. Set |for_keyword|
304 // true for relevance values applicable to keyword provider results. 308 // to true for relevance values applicable to keyword provider results.
305 int CalculateRelevanceForSuggestion(bool for_keyword) const; 309 int CalculateRelevanceForSuggestion(bool for_keyword) const;
306 // Calculate the relevance for navigation results. Set |for_keyword| to true 310 // Calculates the relevance for navigation results. Set |for_keyword| to true
307 // for relevance values applicable to keyword provider results. 311 // for relevance values applicable to keyword provider results.
308 int CalculateRelevanceForNavigation(bool for_keyword) const; 312 int CalculateRelevanceForNavigation(bool for_keyword) const;
309 313
310 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with 314 // Creates an AutocompleteMatch for "Search <engine> for |query_string|" with
311 // the supplied relevance. Adds this match to |map|; if such a match already 315 // the supplied relevance. Adds this match to |map|; if such a match already
312 // exists, whichever one has lower relevance is eliminated. 316 // exists, whichever one has lower relevance is eliminated.
313 void AddMatchToMap(const string16& query_string, 317 void AddMatchToMap(const string16& query_string,
314 const string16& input_text, 318 const string16& input_text,
315 int relevance, 319 int relevance,
316 AutocompleteMatch::Type type, 320 AutocompleteMatch::Type type,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 bool field_trial_triggered_; 390 bool field_trial_triggered_;
387 391
388 // Same as above except that it is maintained across the current Omnibox 392 // Same as above except that it is maintained across the current Omnibox
389 // session. 393 // session.
390 bool field_trial_triggered_in_session_; 394 bool field_trial_triggered_in_session_;
391 395
392 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 396 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
393 }; 397 };
394 398
395 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 399 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider_unittest.cc ('k') | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698