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

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

Issue 320713002: Revert of Omnibox: Combine Two Input Type Enums into One (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 keyword autocomplete provider. The keyword provider 5 // This file contains the keyword autocomplete provider. The keyword provider
6 // is responsible for remembering/suggesting user "search keyword queries" 6 // is responsible for remembering/suggesting user "search keyword queries"
7 // (e.g. "imdb Godzilla") and then fixing them up into valid URLs. An 7 // (e.g. "imdb Godzilla") and then fixing them up into valid URLs. An
8 // instance of it gets created and managed by the autocomplete controller. 8 // instance of it gets created and managed by the autocomplete controller.
9 // KeywordProvider uses a TemplateURLService to find the set of keywords. 9 // KeywordProvider uses a TemplateURLService to find the set of keywords.
10 10
11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 11 #ifndef CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
12 #define CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 12 #define CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
13 13
14 #include <string> 14 #include <string>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "chrome/browser/autocomplete/autocomplete_input.h" 19 #include "chrome/browser/autocomplete/autocomplete_input.h"
20 #include "chrome/browser/autocomplete/autocomplete_provider.h" 20 #include "chrome/browser/autocomplete/autocomplete_provider.h"
21 #include "components/metrics/proto/omnibox_input_type.pb.h"
22 21
23 class KeywordExtensionsDelegate; 22 class KeywordExtensionsDelegate;
24 class Profile; 23 class Profile;
25 class TemplateURL; 24 class TemplateURL;
26 class TemplateURLService; 25 class TemplateURLService;
27 26
28 // Autocomplete provider for keyword input. 27 // Autocomplete provider for keyword input.
29 // 28 //
30 // After construction, the autocomplete controller repeatedly calls Start() 29 // After construction, the autocomplete controller repeatedly calls Start()
31 // with some user input, each time expecting to receive a small set of the best 30 // with some user input, each time expecting to receive a small set of the best
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // Leading whitespace in |*remaining_input| will be trimmed. 107 // Leading whitespace in |*remaining_input| will be trimmed.
109 static bool ExtractKeywordFromInput(const AutocompleteInput& input, 108 static bool ExtractKeywordFromInput(const AutocompleteInput& input,
110 base::string16* keyword, 109 base::string16* keyword,
111 base::string16* remaining_input); 110 base::string16* remaining_input);
112 111
113 // Determines the relevance for some input, given its type, whether the user 112 // Determines the relevance for some input, given its type, whether the user
114 // typed the complete keyword, and whether the user is in "prefer keyword 113 // typed the complete keyword, and whether the user is in "prefer keyword
115 // matches" mode, and whether the keyword supports replacement. 114 // matches" mode, and whether the keyword supports replacement.
116 // If |allow_exact_keyword_match| is false, the relevance for complete 115 // If |allow_exact_keyword_match| is false, the relevance for complete
117 // keywords that support replacements is degraded. 116 // keywords that support replacements is degraded.
118 static int CalculateRelevance(metrics::OmniboxInputType::Type type, 117 static int CalculateRelevance(AutocompleteInput::Type type,
119 bool complete, 118 bool complete,
120 bool support_replacement, 119 bool support_replacement,
121 bool prefer_keyword, 120 bool prefer_keyword,
122 bool allow_exact_keyword_match); 121 bool allow_exact_keyword_match);
123 122
124 // Creates a fully marked-up AutocompleteMatch from the user's input. 123 // Creates a fully marked-up AutocompleteMatch from the user's input.
125 // If |relevance| is negative, calculate a relevance based on heuristics. 124 // If |relevance| is negative, calculate a relevance based on heuristics.
126 AutocompleteMatch CreateAutocompleteMatch( 125 AutocompleteMatch CreateAutocompleteMatch(
127 const TemplateURL* template_url, 126 const TemplateURL* template_url,
128 const AutocompleteInput& input, 127 const AutocompleteInput& input,
(...skipping 15 matching lines...) Expand all
144 TemplateURLService* model_; 143 TemplateURLService* model_;
145 144
146 // Delegate to handle the extensions-only logic for KeywordProvider. 145 // Delegate to handle the extensions-only logic for KeywordProvider.
147 // NULL when extensions are not enabled. May be NULL for tests. 146 // NULL when extensions are not enabled. May be NULL for tests.
148 scoped_ptr<KeywordExtensionsDelegate> extensions_delegate_; 147 scoped_ptr<KeywordExtensionsDelegate> extensions_delegate_;
149 148
150 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); 149 DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
151 }; 150 };
152 151
153 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 152 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/history_url_provider_unittest.cc ('k') | chrome/browser/autocomplete/keyword_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698