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

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

Issue 353223002: Omnibox: Fix URL-What-You-Typed Allowed-To-Be-Default-Match Issues (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove extra << Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 class contains common functionality for search-based autocomplete 5 // This class contains common functionality for search-based autocomplete
6 // providers. Search provider and zero suggest provider both use it for common 6 // providers. Search provider and zero suggest provider both use it for common
7 // functionality. 7 // functionality.
8 8
9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 9 #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 10 #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 int relevance() const { return relevance_; } 128 int relevance() const { return relevance_; }
129 void set_relevance(int relevance) { relevance_ = relevance; } 129 void set_relevance(int relevance) { relevance_ = relevance; }
130 130
131 bool relevance_from_server() const { return relevance_from_server_; } 131 bool relevance_from_server() const { return relevance_from_server_; }
132 void set_relevance_from_server(bool relevance_from_server) { 132 void set_relevance_from_server(bool relevance_from_server) {
133 relevance_from_server_ = relevance_from_server; 133 relevance_from_server_ = relevance_from_server;
134 } 134 }
135 135
136 const std::string& deletion_url() const { return deletion_url_; } 136 const std::string& deletion_url() const { return deletion_url_; }
137 137
138 // Returns if this result is inlineable against the current input |input|.
139 // Non-inlineable results are stale.
140 virtual bool IsInlineable(const base::string16& input) const = 0;
141
142 // Returns the default relevance value for this result (which may 138 // Returns the default relevance value for this result (which may
143 // be left over from a previous omnibox input) given the current 139 // be left over from a previous omnibox input) given the current
144 // input and whether the current input caused a keyword provider 140 // input and whether the current input caused a keyword provider
145 // to be active. 141 // to be active.
146 virtual int CalculateRelevance(const AutocompleteInput& input, 142 virtual int CalculateRelevance(const AutocompleteInput& input,
147 bool keyword_provider_requested) const = 0; 143 bool keyword_provider_requested) const = 0;
148 144
149 protected: 145 protected:
150 // The contents to be displayed and its style info. 146 // The contents to be displayed and its style info.
151 base::string16 match_contents_; 147 base::string16 match_contents_;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 bool should_prefetch() const { return should_prefetch_; } 202 bool should_prefetch() const { return should_prefetch_; }
207 203
208 // Fills in |match_contents_class_| to reflect how |match_contents_| should 204 // Fills in |match_contents_class_| to reflect how |match_contents_| should
209 // be displayed and bolded against the current |input_text|. If 205 // be displayed and bolded against the current |input_text|. If
210 // |allow_bolding_all| is false and |match_contents_class_| would have all 206 // |allow_bolding_all| is false and |match_contents_class_| would have all
211 // of |match_contents_| bolded, do nothing. 207 // of |match_contents_| bolded, do nothing.
212 void ClassifyMatchContents(const bool allow_bolding_all, 208 void ClassifyMatchContents(const bool allow_bolding_all,
213 const base::string16& input_text); 209 const base::string16& input_text);
214 210
215 // Result: 211 // Result:
216 virtual bool IsInlineable(const base::string16& input) const OVERRIDE;
217 virtual int CalculateRelevance( 212 virtual int CalculateRelevance(
218 const AutocompleteInput& input, 213 const AutocompleteInput& input,
219 bool keyword_provider_requested) const OVERRIDE; 214 bool keyword_provider_requested) const OVERRIDE;
220 215
221 private: 216 private:
222 // The search terms to be used for this suggestion. 217 // The search terms to be used for this suggestion.
223 base::string16 suggestion_; 218 base::string16 suggestion_;
224 219
225 // The contents to be displayed as prefix of match contents. 220 // The contents to be displayed as prefix of match contents.
226 // Used for postfix suggestions to display a leading ellipsis (or some 221 // Used for postfix suggestions to display a leading ellipsis (or some
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // Fills in |match_contents_| and |match_contents_class_| to reflect how 264 // Fills in |match_contents_| and |match_contents_class_| to reflect how
270 // the URL should be displayed and bolded against the current |input_text| 265 // the URL should be displayed and bolded against the current |input_text|
271 // and user |languages|. If |allow_bolding_nothing| is false and 266 // and user |languages|. If |allow_bolding_nothing| is false and
272 // |match_contents_class_| would result in an entirely unbolded 267 // |match_contents_class_| would result in an entirely unbolded
273 // |match_contents_|, do nothing. 268 // |match_contents_|, do nothing.
274 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, 269 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing,
275 const base::string16& input_text, 270 const base::string16& input_text,
276 const std::string& languages); 271 const std::string& languages);
277 272
278 // Result: 273 // Result:
279 virtual bool IsInlineable(const base::string16& input) const OVERRIDE;
280 virtual int CalculateRelevance( 274 virtual int CalculateRelevance(
281 const AutocompleteInput& input, 275 const AutocompleteInput& input,
282 bool keyword_provider_requested) const OVERRIDE; 276 bool keyword_provider_requested) const OVERRIDE;
283 277
284 private: 278 private:
285 // The suggested url for navigation. 279 // The suggested url for navigation.
286 GURL url_; 280 GURL url_;
287 281
288 // The properly formatted ("fixed up") URL string with equivalent meaning 282 // The properly formatted ("fixed up") URL string with equivalent meaning
289 // to the one in |url_|. 283 // to the one in |url_|.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 520
527 // True if this provider's results are being displayed in the app list. By 521 // True if this provider's results are being displayed in the app list. By
528 // default this is false, meaning that the results will be shown in the 522 // default this is false, meaning that the results will be shown in the
529 // omnibox. 523 // omnibox.
530 bool in_app_list_; 524 bool in_app_list_;
531 525
532 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); 526 DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider);
533 }; 527 };
534 528
535 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ 529 #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698