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

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: fix crashes on about: schemes 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // Fills in |match_contents_| and |match_contents_class_| to reflect how 262 // Fills in |match_contents_| and |match_contents_class_| to reflect how
268 // the URL should be displayed and bolded against the current |input_text| 263 // the URL should be displayed and bolded against the current |input_text|
269 // and user |languages|. If |allow_bolding_nothing| is false and 264 // and user |languages|. If |allow_bolding_nothing| is false and
270 // |match_contents_class_| would result in an entirely unbolded 265 // |match_contents_class_| would result in an entirely unbolded
271 // |match_contents_|, do nothing. 266 // |match_contents_|, do nothing.
272 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, 267 void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing,
273 const base::string16& input_text, 268 const base::string16& input_text,
274 const std::string& languages); 269 const std::string& languages);
275 270
276 // Result: 271 // Result:
277 virtual bool IsInlineable(const base::string16& input) const OVERRIDE;
278 virtual int CalculateRelevance( 272 virtual int CalculateRelevance(
279 const AutocompleteInput& input, 273 const AutocompleteInput& input,
280 bool keyword_provider_requested) const OVERRIDE; 274 bool keyword_provider_requested) const OVERRIDE;
281 275
282 private: 276 private:
283 // The suggested url for navigation. 277 // The suggested url for navigation.
284 GURL url_; 278 GURL url_;
285 279
286 // The properly formatted ("fixed up") URL string with equivalent meaning 280 // The properly formatted ("fixed up") URL string with equivalent meaning
287 // to the one in |url_|. 281 // to the one in |url_|.
(...skipping 238 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
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_result.cc ('k') | chrome/browser/autocomplete/base_search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698