| 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_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // instantiated. | 52 // instantiated. |
| 53 AutocompleteController(Profile* profile, | 53 AutocompleteController(Profile* profile, |
| 54 AutocompleteControllerDelegate* delegate, | 54 AutocompleteControllerDelegate* delegate, |
| 55 int provider_types); | 55 int provider_types); |
| 56 ~AutocompleteController(); | 56 ~AutocompleteController(); |
| 57 | 57 |
| 58 // Starts an autocomplete query, which continues until all providers are | 58 // Starts an autocomplete query, which continues until all providers are |
| 59 // done or the query is Stop()ed. It is safe to Start() a new query without | 59 // done or the query is Stop()ed. It is safe to Start() a new query without |
| 60 // Stop()ing the previous one. | 60 // Stop()ing the previous one. |
| 61 // | 61 // |
| 62 // See AutocompleteInput::desired_tld() for meaning of |desired_tld|. | 62 // See AutocompleteInput::AutocompleteInput(...) for more details regarding |
| 63 // | 63 // |input| params. |
| 64 // |prevent_inline_autocomplete| is true if the generated result set should | |
| 65 // not require inline autocomplete for the default match. This is difficult | |
| 66 // to explain in the abstract; the practical use case is that after the user | |
| 67 // deletes text in the edit, the HistoryURLProvider should make sure not to | |
| 68 // promote a match requiring inline autocomplete too highly. | |
| 69 // | |
| 70 // |prefer_keyword| should be true when the keyword UI is onscreen; this will | |
| 71 // bias the autocomplete result set toward the keyword provider when the input | |
| 72 // string is a bare keyword. | |
| 73 // | |
| 74 // |allow_exact_keyword_match| should be false when triggering keyword mode on | |
| 75 // the input string would be surprising or wrong, e.g. when highlighting text | |
| 76 // in a page and telling the browser to search for it or navigate to it. This | |
| 77 // parameter only applies to substituting keywords. | |
| 78 | |
| 79 // If |matches_requested| is BEST_MATCH or SYNCHRONOUS_MATCHES the controller | |
| 80 // asks the providers to only return matches which are synchronously | |
| 81 // available, which should mean that all providers will be done immediately. | |
| 82 // | 64 // |
| 83 // The controller calls AutocompleteControllerDelegate::OnResultChanged() from | 65 // The controller calls AutocompleteControllerDelegate::OnResultChanged() from |
| 84 // inside this call at least once. If matches are available later on that | 66 // inside this call at least once. If matches are available later on that |
| 85 // result in changing the result set the delegate is notified again. When the | 67 // result in changing the result set the delegate is notified again. When the |
| 86 // controller is done the notification AUTOCOMPLETE_CONTROLLER_RESULT_READY is | 68 // controller is done the notification AUTOCOMPLETE_CONTROLLER_RESULT_READY is |
| 87 // sent. | 69 // sent. |
| 88 void Start(const string16& text, | 70 void Start(const AutocompleteInput& input); |
| 89 const string16& desired_tld, | |
| 90 bool prevent_inline_autocomplete, | |
| 91 bool prefer_keyword, | |
| 92 bool allow_exact_keyword_match, | |
| 93 AutocompleteInput::MatchesRequested matches_requested); | |
| 94 | 71 |
| 95 // Cancels the current query, ensuring there will be no future notifications | 72 // Cancels the current query, ensuring there will be no future notifications |
| 96 // fired. If new matches have come in since the most recent notification was | 73 // fired. If new matches have come in since the most recent notification was |
| 97 // fired, they will be discarded. | 74 // fired, they will be discarded. |
| 98 // | 75 // |
| 99 // If |clear_result| is true, the controller will also erase the result set. | 76 // If |clear_result| is true, the controller will also erase the result set. |
| 100 void Stop(bool clear_result); | 77 void Stop(bool clear_result); |
| 101 | 78 |
| 102 // Begin asynchronously fetching zero-suggest suggestions for |url|. | 79 // Begin asynchronously fetching zero-suggest suggestions for |url|. |
| 103 // |user_text| is the text entered in the omnibox, which may be non-empty if | 80 // |user_text| is the text entered in the omnibox, which may be non-empty if |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 207 |
| 231 // Has StartZeroSuggest() been called but not Start()? | 208 // Has StartZeroSuggest() been called but not Start()? |
| 232 bool in_zero_suggest_; | 209 bool in_zero_suggest_; |
| 233 | 210 |
| 234 Profile* profile_; | 211 Profile* profile_; |
| 235 | 212 |
| 236 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); | 213 DISALLOW_COPY_AND_ASSIGN(AutocompleteController); |
| 237 }; | 214 }; |
| 238 | 215 |
| 239 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ | 216 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_CONTROLLER_H_ |
| OLD | NEW |