OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // |input_text| is the text the user input into the edit. |input_text| differs | 57 // |input_text| is the text the user input into the edit. |input_text| differs |
58 // from |input_.text()| if the input contained whitespace. | 58 // from |input_.text()| if the input contained whitespace. |
59 // | 59 // |
60 // This method also marks the search provider as no longer needing to wait for | 60 // This method also marks the search provider as no longer needing to wait for |
61 // the instant result. | 61 // the instant result. |
62 void FinalizeInstantQuery(const string16& input_text, | 62 void FinalizeInstantQuery(const string16& input_text, |
63 const string16& suggest_text); | 63 const string16& suggest_text); |
64 | 64 |
65 // AutocompleteProvider | 65 // AutocompleteProvider |
66 virtual void Start(const AutocompleteInput& input, | 66 virtual void Start(const AutocompleteInput& input, |
67 bool minimal_changes); | 67 bool minimal_changes) OVERRIDE; |
68 virtual void Stop(); | 68 virtual void Stop() OVERRIDE; |
| 69 virtual void PostProcessResult(AutocompleteResult* result) OVERRIDE; |
69 | 70 |
70 // URLFetcher::Delegate | 71 // URLFetcher::Delegate |
71 virtual void OnURLFetchComplete(const URLFetcher* source, | 72 virtual void OnURLFetchComplete(const URLFetcher* source, |
72 const GURL& url, | 73 const GURL& url, |
73 const net::URLRequestStatus& status, | 74 const net::URLRequestStatus& status, |
74 int response_code, | 75 int response_code, |
75 const net::ResponseCookies& cookies, | 76 const net::ResponseCookies& cookies, |
76 const std::string& data); | 77 const std::string& data); |
77 | 78 |
78 // ID used in creating URLFetcher for default provider's suggest results. | 79 // ID used in creating URLFetcher for default provider's suggest results. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 MatchMap* map); | 264 MatchMap* map); |
264 | 265 |
265 // Returns an AutocompleteMatch for a navigational suggestion. | 266 // Returns an AutocompleteMatch for a navigational suggestion. |
266 AutocompleteMatch NavigationToMatch(const NavigationResult& query_string, | 267 AutocompleteMatch NavigationToMatch(const NavigationResult& query_string, |
267 int relevance, | 268 int relevance, |
268 bool is_keyword); | 269 bool is_keyword); |
269 | 270 |
270 // Updates the value of |done_| from the internal state. | 271 // Updates the value of |done_| from the internal state. |
271 void UpdateDone(); | 272 void UpdateDone(); |
272 | 273 |
273 // Updates the description/description_class of the first search match. | |
274 void UpdateFirstSearchMatchDescription(); | |
275 | |
276 // Should we query for suggest results immediately? This is normally false, | 274 // Should we query for suggest results immediately? This is normally false, |
277 // but may be set to true during testing. | 275 // but may be set to true during testing. |
278 static bool query_suggest_immediately_; | 276 static bool query_suggest_immediately_; |
279 | 277 |
280 // Maintains the TemplateURLs used. | 278 // Maintains the TemplateURLs used. |
281 Providers providers_; | 279 Providers providers_; |
282 | 280 |
283 // The user's input. | 281 // The user's input. |
284 AutocompleteInput input_; | 282 AutocompleteInput input_; |
285 | 283 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 // Has FinalizeInstantQuery been invoked since the last |Start|? | 317 // Has FinalizeInstantQuery been invoked since the last |Start|? |
320 bool instant_finalized_; | 318 bool instant_finalized_; |
321 | 319 |
322 // The |suggest_text| parameter passed to FinalizeInstantQuery. | 320 // The |suggest_text| parameter passed to FinalizeInstantQuery. |
323 string16 default_provider_suggest_text_; | 321 string16 default_provider_suggest_text_; |
324 | 322 |
325 DISALLOW_COPY_AND_ASSIGN(SearchProvider); | 323 DISALLOW_COPY_AND_ASSIGN(SearchProvider); |
326 }; | 324 }; |
327 | 325 |
328 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ | 326 #endif // CHROME_BROWSER_AUTOCOMPLETE_SEARCH_PROVIDER_H_ |
OLD | NEW |