| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 // a provider the opportunity to add diagnostic information to the | 200 // a provider the opportunity to add diagnostic information to the |
| 201 // logs. A provider is expected to append a single entry of whatever | 201 // logs. A provider is expected to append a single entry of whatever |
| 202 // information it wants to |provider_info|. | 202 // information it wants to |provider_info|. |
| 203 virtual void AddProviderInfo(ProvidersInfo* provider_info) const; | 203 virtual void AddProviderInfo(ProvidersInfo* provider_info) const; |
| 204 | 204 |
| 205 // Called when a new omnibox session starts or the current session ends. | 205 // Called when a new omnibox session starts or the current session ends. |
| 206 // This gives the opportunity to reset the internal state, if any, associated | 206 // This gives the opportunity to reset the internal state, if any, associated |
| 207 // with the previous session. | 207 // with the previous session. |
| 208 virtual void ResetSession(); | 208 virtual void ResetSession(); |
| 209 | 209 |
| 210 // Returns whether |input| begins "http:" or "view-source:http:". |
| 211 static bool HasHTTPScheme(const string16& input); |
| 212 |
| 210 // A convenience function to call net::FormatUrl() with the current set of | 213 // A convenience function to call net::FormatUrl() with the current set of |
| 211 // "Accept Languages" when check_accept_lang is true. Otherwise, it's called | 214 // "Accept Languages" when check_accept_lang is true. Otherwise, it's called |
| 212 // with an empty list. | 215 // with an empty list. |
| 213 string16 StringForURLDisplay(const GURL& url, | 216 string16 StringForURLDisplay(const GURL& url, |
| 214 bool check_accept_lang, | 217 bool check_accept_lang, |
| 215 bool trim_http) const; | 218 bool trim_http) const; |
| 216 | 219 |
| 217 // Returns the set of matches for the current query. | 220 // Returns the set of matches for the current query. |
| 218 const ACMatches& matches() const { return matches_; } | 221 const ACMatches& matches() const { return matches_; } |
| 219 | 222 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 235 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once | 238 // TODO(pkasting): http://b/1111299 , http://b/933133 This should go away once |
| 236 // we have good relevance heuristics; the controller should handle all | 239 // we have good relevance heuristics; the controller should handle all |
| 237 // culling. | 240 // culling. |
| 238 static const size_t kMaxMatches; | 241 static const size_t kMaxMatches; |
| 239 | 242 |
| 240 protected: | 243 protected: |
| 241 friend class base::RefCountedThreadSafe<AutocompleteProvider>; | 244 friend class base::RefCountedThreadSafe<AutocompleteProvider>; |
| 242 | 245 |
| 243 virtual ~AutocompleteProvider(); | 246 virtual ~AutocompleteProvider(); |
| 244 | 247 |
| 245 // Returns whether |input| begins "http:" or "view-source:http:". | |
| 246 static bool HasHTTPScheme(const string16& input); | |
| 247 | |
| 248 // Updates the starred state of each of the matches in matches_ from the | 248 // Updates the starred state of each of the matches in matches_ from the |
| 249 // profile's bookmark bar model. | 249 // profile's bookmark bar model. |
| 250 void UpdateStarredStateOfMatches(); | 250 void UpdateStarredStateOfMatches(); |
| 251 | 251 |
| 252 // The profile associated with the AutocompleteProvider. Reference is not | 252 // The profile associated with the AutocompleteProvider. Reference is not |
| 253 // owned by us. | 253 // owned by us. |
| 254 Profile* profile_; | 254 Profile* profile_; |
| 255 | 255 |
| 256 AutocompleteProviderListener* listener_; | 256 AutocompleteProviderListener* listener_; |
| 257 ACMatches matches_; | 257 ACMatches matches_; |
| 258 bool done_; | 258 bool done_; |
| 259 | 259 |
| 260 Type type_; | 260 Type type_; |
| 261 | 261 |
| 262 private: | 262 private: |
| 263 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); | 263 DISALLOW_COPY_AND_ASSIGN(AutocompleteProvider); |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 typedef std::vector<AutocompleteProvider*> ACProviders; | 266 typedef std::vector<AutocompleteProvider*> ACProviders; |
| 267 | 267 |
| 268 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ | 268 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_PROVIDER_H_ |
| OLD | NEW |