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

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

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 non-keyword autocomplete entries that start with
7 // "Search <engine> for ...", including searching for the current input string, 7 // "Search <engine> for ...", including searching for the current input string,
8 // search history, and search suggestions. An instance of it gets created and 8 // search 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 //
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 DCHECK(valid_keyword_provider()); 113 DCHECK(valid_keyword_provider());
114 return cached_keyword_provider_; 114 return cached_keyword_provider_;
115 } 115 }
116 116
117 // Returns true of the keyword provider is valid. 117 // Returns true of the keyword provider is valid.
118 bool valid_keyword_provider() const { return !!keyword_provider_; } 118 bool valid_keyword_provider() const { return !!keyword_provider_; }
119 119
120 // Returns true if the keyword provider is valid and has a valid suggest 120 // Returns true if the keyword provider is valid and has a valid suggest
121 // url. 121 // url.
122 bool valid_suggest_for_keyword_provider() const { 122 bool valid_suggest_for_keyword_provider() const {
123 return keyword_provider_ && cached_keyword_provider_.suggestions_url(); 123 return keyword_provider_ &&
124 !cached_keyword_provider_.suggestions_url().empty();
124 } 125 }
125 126
126 // Returns true of the default provider is valid. 127 // Returns true of the default provider is valid.
127 bool valid_default_provider() const { return !!default_provider_; } 128 bool valid_default_provider() const { return !!default_provider_; }
128 129
129 // Returns true if the default provider is valid and has a valid suggest 130 // Returns true if the default provider is valid and has a valid suggest
130 // url. 131 // url.
131 bool valid_suggest_for_default_provider() const { 132 bool valid_suggest_for_default_provider() const {
132 return default_provider_ && cached_default_provider_.suggestions_url(); 133 return default_provider_ &&
134 !cached_default_provider_.suggestions_url().empty();
133 } 135 }
134 136
135 // Returns true if |from_keyword_provider| is true, or 137 // Returns true if |from_keyword_provider| is true, or
136 // the keyword provider is not valid. 138 // the keyword provider is not valid.
137 bool is_primary_provider(bool from_keyword_provider) const { 139 bool is_primary_provider(bool from_keyword_provider) const {
138 return from_keyword_provider || !valid_keyword_provider(); 140 return from_keyword_provider || !valid_keyword_provider();
139 } 141 }
140 142
141 private: 143 private:
142 // Cached across the life of a query so we behave consistently even if the 144 // Cached across the life of a query so we behave consistently even if the
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // Has FinalizeInstantQuery been invoked since the last |Start|? 330 // Has FinalizeInstantQuery been invoked since the last |Start|?
329 bool instant_finalized_; 331 bool instant_finalized_;
330 332
331 // The |suggest_text| parameter passed to FinalizeInstantQuery. 333 // The |suggest_text| parameter passed to FinalizeInstantQuery.
332 string16 default_provider_suggest_text_; 334 string16 default_provider_suggest_text_;
333 335
334 DISALLOW_COPY_AND_ASSIGN(SearchProvider); 336 DISALLOW_COPY_AND_ASSIGN(SearchProvider);
335 }; 337 };
336 338
337 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ 339 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider.cc ('k') | chrome/browser/autocomplete/search_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698