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_EDIT_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/string16.h" | 9 #include "base/string16.h" |
10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 // Sent when the edit is losing focus. |view_gaining_focus| is the view | 41 // Sent when the edit is losing focus. |view_gaining_focus| is the view |
42 // gaining focus and may be null. | 42 // gaining focus and may be null. |
43 virtual void OnAutocompleteLosingFocus( | 43 virtual void OnAutocompleteLosingFocus( |
44 gfx::NativeView view_gaining_focus) = 0; | 44 gfx::NativeView view_gaining_focus) = 0; |
45 | 45 |
46 // Sent prior to OnAutoCompleteAccept and before the model has been reverted. | 46 // Sent prior to OnAutoCompleteAccept and before the model has been reverted. |
47 // This is only invoked if the popup is closed before invoking | 47 // This is only invoked if the popup is closed before invoking |
48 // OnAutoCompleteAccept. | 48 // OnAutoCompleteAccept. |
49 virtual void OnAutocompleteWillAccept() = 0; | 49 virtual void OnAutocompleteWillAccept() = 0; |
50 | 50 |
51 // Commits the suggested text. |typed_text| is the current text showing in the | 51 // Commits the suggested text. If |skip_inline_autocomplete| is true then the |
52 // autocomplete. Returns true if the text was committed. | 52 // suggested text will be committed as final text as if it's inputted by the |
53 virtual bool OnCommitSuggestedText(const string16& typed_text) = 0; | 53 // user, rather than as inline autocomplete suggest. |
| 54 // Returns true if the text was committed. |
| 55 virtual bool OnCommitSuggestedText(bool skip_inline_autocomplete) = 0; |
54 | 56 |
55 // Accepts the currently showing instant preview, if any, and returns true. | 57 // Accepts the currently showing instant preview, if any, and returns true. |
56 // Returns false if there is no instant preview showing. | 58 // Returns false if there is no instant preview showing. |
57 virtual bool AcceptCurrentInstantPreview() = 0; | 59 virtual bool AcceptCurrentInstantPreview() = 0; |
58 | 60 |
59 // Invoked when the popup is going to change its bounds to |bounds|. | 61 // Invoked when the popup is going to change its bounds to |bounds|. |
60 virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) = 0; | 62 virtual void OnPopupBoundsChanged(const gfx::Rect& bounds) = 0; |
61 | 63 |
62 // When the user presses enter or selects a line with the mouse, this | 64 // When the user presses enter or selects a line with the mouse, this |
63 // function will get called synchronously with the url to open and | 65 // function will get called synchronously with the url to open and |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 186 |
185 // Updates permanent_text_ to |new_permanent_text|. Returns true if this | 187 // Updates permanent_text_ to |new_permanent_text|. Returns true if this |
186 // change should be immediately user-visible, because either the user is not | 188 // change should be immediately user-visible, because either the user is not |
187 // editing or the edit does not have focus. | 189 // editing or the edit does not have focus. |
188 bool UpdatePermanentText(const string16& new_permanent_text); | 190 bool UpdatePermanentText(const string16& new_permanent_text); |
189 | 191 |
190 // Sets the user_text_ to |text|. Only the View should call this. | 192 // Sets the user_text_ to |text|. Only the View should call this. |
191 void SetUserText(const string16& text); | 193 void SetUserText(const string16& text); |
192 | 194 |
193 // Calls through to SearchProvider::FinalizeInstantQuery. | 195 // Calls through to SearchProvider::FinalizeInstantQuery. |
| 196 // If |skip_inline_autocomplete| is true then the |suggest_text| will be |
| 197 // turned into final text instead of inline autocomplete suggest. |
194 void FinalizeInstantQuery(const string16& input_text, | 198 void FinalizeInstantQuery(const string16& input_text, |
195 const string16& suggest_text); | 199 const string16& suggest_text, |
| 200 bool skip_inline_autocomplete); |
196 | 201 |
197 // Reverts the edit model back to its unedited state (permanent text showing, | 202 // Reverts the edit model back to its unedited state (permanent text showing, |
198 // no user input in progress). | 203 // no user input in progress). |
199 void Revert(); | 204 void Revert(); |
200 | 205 |
201 // Directs the popup to start autocomplete. | 206 // Directs the popup to start autocomplete. |
202 void StartAutocomplete(bool has_selected_text, | 207 void StartAutocomplete(bool has_selected_text, |
203 bool prevent_inline_autocomplete) const; | 208 bool prevent_inline_autocomplete) const; |
204 | 209 |
205 // Determines whether the user can "paste and go", given the specified text. | 210 // Determines whether the user can "paste and go", given the specified text. |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 mutable GURL paste_and_go_url_; | 491 mutable GURL paste_and_go_url_; |
487 mutable PageTransition::Type paste_and_go_transition_; | 492 mutable PageTransition::Type paste_and_go_transition_; |
488 mutable GURL paste_and_go_alternate_nav_url_; | 493 mutable GURL paste_and_go_alternate_nav_url_; |
489 | 494 |
490 Profile* profile_; | 495 Profile* profile_; |
491 | 496 |
492 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); | 497 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditModel); |
493 }; | 498 }; |
494 | 499 |
495 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ | 500 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_H_ |
OLD | NEW |