| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_POPUP_MODEL_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
| 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete.h" | 10 #include "chrome/browser/autocomplete/autocomplete.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 AutocompletePopupModel(AutocompletePopupView* popup_view, | 23 AutocompletePopupModel(AutocompletePopupView* popup_view, |
| 24 AutocompleteEditModel* edit_model, | 24 AutocompleteEditModel* edit_model, |
| 25 Profile* profile); | 25 Profile* profile); |
| 26 ~AutocompletePopupModel(); | 26 ~AutocompletePopupModel(); |
| 27 | 27 |
| 28 // Invoked when the profile has changed. | 28 // Invoked when the profile has changed. |
| 29 void SetProfile(Profile* profile); | 29 void SetProfile(Profile* profile); |
| 30 | 30 |
| 31 // Starts a new query running. These parameters are passed through to the | 31 // Starts a new query running. These parameters are passed through to the |
| 32 // autocomplete controller; see comments there. | 32 // autocomplete controller; see comments there. |
| 33 void StartAutocomplete(const string16& text, | 33 void StartAutocomplete(const std::wstring& text, |
| 34 const string16& desired_tld, | 34 const std::wstring& desired_tld, |
| 35 bool prevent_inline_autocomplete, | 35 bool prevent_inline_autocomplete, |
| 36 bool prefer_keyword, | 36 bool prefer_keyword, |
| 37 bool allow_exact_keyword_match); | 37 bool allow_exact_keyword_match); |
| 38 | 38 |
| 39 // Closes the window and cancels any pending asynchronous queries. | 39 // Closes the window and cancels any pending asynchronous queries. |
| 40 void StopAutocomplete(); | 40 void StopAutocomplete(); |
| 41 | 41 |
| 42 // Returns true if the popup is currently open. | 42 // Returns true if the popup is currently open. |
| 43 bool IsOpen() const; | 43 bool IsOpen() const; |
| 44 | 44 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 // can move too. | 91 // can move too. |
| 92 void InfoForCurrentSelection(AutocompleteMatch* match, | 92 void InfoForCurrentSelection(AutocompleteMatch* match, |
| 93 GURL* alternate_nav_url) const; | 93 GURL* alternate_nav_url) const; |
| 94 | 94 |
| 95 // Gets the selected keyword or keyword hint for the given match. Returns | 95 // Gets the selected keyword or keyword hint for the given match. Returns |
| 96 // true if |keyword| represents a keyword hint, or false if |keyword| | 96 // true if |keyword| represents a keyword hint, or false if |keyword| |
| 97 // represents a selected keyword. (|keyword| will always be set [though | 97 // represents a selected keyword. (|keyword| will always be set [though |
| 98 // possibly to the empty string], and you cannot have both a selected keyword | 98 // possibly to the empty string], and you cannot have both a selected keyword |
| 99 // and a keyword hint simultaneously.) | 99 // and a keyword hint simultaneously.) |
| 100 bool GetKeywordForMatch(const AutocompleteMatch& match, | 100 bool GetKeywordForMatch(const AutocompleteMatch& match, |
| 101 string16* keyword) const; | 101 std::wstring* keyword) const; |
| 102 | 102 |
| 103 // Calls through to SearchProvider::FinalizeInstantQuery. | 103 // Calls through to SearchProvider::FinalizeInstantQuery. |
| 104 void FinalizeInstantQuery(const string16& input_text, | 104 void FinalizeInstantQuery(const std::wstring& input_text, |
| 105 const string16& suggest_text); | 105 const std::wstring& suggest_text); |
| 106 | 106 |
| 107 // Returns a pointer to a heap-allocated AutocompleteLog containing the | 107 // Returns a pointer to a heap-allocated AutocompleteLog containing the |
| 108 // current input text, selected match, and result set. The caller is | 108 // current input text, selected match, and result set. The caller is |
| 109 // responsible for deleting the object. | 109 // responsible for deleting the object. |
| 110 AutocompleteLog* GetAutocompleteLog(); | 110 AutocompleteLog* GetAutocompleteLog(); |
| 111 | 111 |
| 112 // Immediately updates and opens the popup if necessary, then moves the | 112 // Immediately updates and opens the popup if necessary, then moves the |
| 113 // current selection down (|count| > 0) or up (|count| < 0), clamping to the | 113 // current selection down (|count| > 0) or up (|count| < 0), clamping to the |
| 114 // first or last result if necessary. If |count| == 0, the selection will be | 114 // first or last result if necessary. If |count| == 0, the selection will be |
| 115 // unchanged, but the popup will still redraw and modify the text in the | 115 // unchanged, but the popup will still redraw and modify the text in the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // which should only be true when the popup is closed. | 154 // which should only be true when the popup is closed. |
| 155 size_t selected_line_; | 155 size_t selected_line_; |
| 156 | 156 |
| 157 // The match the user has manually chosen, if any. | 157 // The match the user has manually chosen, if any. |
| 158 AutocompleteResult::Selection manually_selected_match_; | 158 AutocompleteResult::Selection manually_selected_match_; |
| 159 | 159 |
| 160 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); | 160 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupModel); |
| 161 }; | 161 }; |
| 162 | 162 |
| 163 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ | 163 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_MODEL_H_ |
| OLD | NEW |