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

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

Issue 319523005: Omnibox: Combine Two Input Type Enums into One (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove blank line 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 "chrome/browser/autocomplete/autocomplete_input.h" 18 #include "chrome/browser/autocomplete/autocomplete_input.h"
19 #include "chrome/browser/autocomplete/autocomplete_provider.h" 19 #include "chrome/browser/autocomplete/autocomplete_provider.h"
20 #include "components/metrics/proto/omnibox_input_type.pb.h"
20 #include "content/public/browser/notification_observer.h" 21 #include "content/public/browser/notification_observer.h"
21 #include "content/public/browser/notification_registrar.h" 22 #include "content/public/browser/notification_registrar.h"
22 23
23 class Profile; 24 class Profile;
24 class TemplateURL; 25 class TemplateURL;
25 class TemplateURLService; 26 class TemplateURLService;
26 27
27 // Autocomplete provider for keyword input. 28 // Autocomplete provider for keyword input.
28 // 29 //
29 // After construction, the autocomplete controller repeatedly calls Start() 30 // After construction, the autocomplete controller repeatedly calls Start()
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 // Leading whitespace in |*remaining_input| will be trimmed. 110 // Leading whitespace in |*remaining_input| will be trimmed.
110 static bool ExtractKeywordFromInput(const AutocompleteInput& input, 111 static bool ExtractKeywordFromInput(const AutocompleteInput& input,
111 base::string16* keyword, 112 base::string16* keyword,
112 base::string16* remaining_input); 113 base::string16* remaining_input);
113 114
114 // Determines the relevance for some input, given its type, whether the user 115 // Determines the relevance for some input, given its type, whether the user
115 // typed the complete keyword, and whether the user is in "prefer keyword 116 // typed the complete keyword, and whether the user is in "prefer keyword
116 // matches" mode, and whether the keyword supports replacement. 117 // matches" mode, and whether the keyword supports replacement.
117 // If |allow_exact_keyword_match| is false, the relevance for complete 118 // If |allow_exact_keyword_match| is false, the relevance for complete
118 // keywords that support replacements is degraded. 119 // keywords that support replacements is degraded.
119 static int CalculateRelevance(AutocompleteInput::Type type, 120 static int CalculateRelevance(metrics::OmniboxInputType::Type type,
120 bool complete, 121 bool complete,
121 bool support_replacement, 122 bool support_replacement,
122 bool prefer_keyword, 123 bool prefer_keyword,
123 bool allow_exact_keyword_match); 124 bool allow_exact_keyword_match);
124 125
125 // Creates a fully marked-up AutocompleteMatch from the user's input. 126 // Creates a fully marked-up AutocompleteMatch from the user's input.
126 // If |relevance| is negative, calculate a relevance based on heuristics. 127 // If |relevance| is negative, calculate a relevance based on heuristics.
127 AutocompleteMatch CreateAutocompleteMatch( 128 AutocompleteMatch CreateAutocompleteMatch(
128 const TemplateURL* template_url, 129 const TemplateURL* template_url,
129 const AutocompleteInput& input, 130 const AutocompleteInput& input,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 // If non-empty, holds the ID of the extension whose keyword is currently in 169 // If non-empty, holds the ID of the extension whose keyword is currently in
169 // the URL bar while the autocomplete popup is open. 170 // the URL bar while the autocomplete popup is open.
170 std::string current_keyword_extension_id_; 171 std::string current_keyword_extension_id_;
171 172
172 content::NotificationRegistrar registrar_; 173 content::NotificationRegistrar registrar_;
173 174
174 DISALLOW_COPY_AND_ASSIGN(KeywordProvider); 175 DISALLOW_COPY_AND_ASSIGN(KeywordProvider);
175 }; 176 };
176 177
177 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_ 178 #endif // CHROME_BROWSER_AUTOCOMPLETE_KEYWORD_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698