| 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 // This file defines the interface class OmniboxView. Each toolkit will | 5 // This file defines the interface class OmniboxView. Each toolkit will |
| 6 // implement the edit view differently, so that code is inherently platform | 6 // implement the edit view differently, so that code is inherently platform |
| 7 // specific. However, the OmniboxEditModel needs to do some communication with | 7 // specific. However, the OmniboxEditModel needs to do some communication with |
| 8 // the view. Since the model is shared between platforms, we need to define an | 8 // the view. Since the model is shared between platforms, we need to define an |
| 9 // interface that all view implementations will share. | 9 // interface that all view implementations will share. |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 int GetIcon() const; | 99 int GetIcon() const; |
| 100 | 100 |
| 101 // The user text is the text the user has manually keyed in. When present, | 101 // The user text is the text the user has manually keyed in. When present, |
| 102 // this is shown in preference to the permanent text; hitting escape will | 102 // this is shown in preference to the permanent text; hitting escape will |
| 103 // revert to the permanent text. | 103 // revert to the permanent text. |
| 104 void SetUserText(const string16& text); | 104 void SetUserText(const string16& text); |
| 105 virtual void SetUserText(const string16& text, | 105 virtual void SetUserText(const string16& text, |
| 106 const string16& display_text, | 106 const string16& display_text, |
| 107 bool update_popup); | 107 bool update_popup); |
| 108 | 108 |
| 109 // Sets the window text and the caret position. | 109 // Sets the window text and the caret position. |notify_text_changed| is true |
| 110 // if the model should be notified of the change. |
| 110 virtual void SetWindowTextAndCaretPos(const string16& text, | 111 virtual void SetWindowTextAndCaretPos(const string16& text, |
| 111 size_t caret_pos, | 112 size_t caret_pos, |
| 112 bool update_popup, | 113 bool update_popup, |
| 113 bool notify_text_changed) = 0; | 114 bool notify_text_changed) = 0; |
| 114 | 115 |
| 115 // Sets the edit to forced query mode. Practically speaking, this means that | 116 // Sets the edit to forced query mode. Practically speaking, this means that |
| 116 // if the edit is not in forced query mode, its text is set to "?" with the | 117 // if the edit is not in forced query mode, its text is set to "?" with the |
| 117 // cursor at the end, and if the edit is in forced query mode (its first | 118 // cursor at the end, and if the edit is in forced query mode (its first |
| 118 // non-whitespace character is '?'), the text after the '?' is selected. | 119 // non-whitespace character is '?'), the text after the '?' is selected. |
| 119 // | 120 // |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // Sets the focus to the autocomplete view. | 154 // Sets the focus to the autocomplete view. |
| 154 virtual void SetFocus() = 0; | 155 virtual void SetFocus() = 0; |
| 155 | 156 |
| 156 // Shows or hides the caret based on whether the model's is_caret_visible() is | 157 // Shows or hides the caret based on whether the model's is_caret_visible() is |
| 157 // true. | 158 // true. |
| 158 virtual void ApplyCaretVisibility() = 0; | 159 virtual void ApplyCaretVisibility() = 0; |
| 159 | 160 |
| 160 // Called when the temporary text in the model may have changed. | 161 // Called when the temporary text in the model may have changed. |
| 161 // |display_text| is the new text to show; |save_original_selection| is true | 162 // |display_text| is the new text to show; |save_original_selection| is true |
| 162 // when there wasn't previously a temporary text and thus we need to save off | 163 // when there wasn't previously a temporary text and thus we need to save off |
| 163 // the user's existing selection. | 164 // the user's existing selection. |notify_text_changed| is true if the model |
| 165 // should be notified of the change. |
| 164 virtual void OnTemporaryTextMaybeChanged(const string16& display_text, | 166 virtual void OnTemporaryTextMaybeChanged(const string16& display_text, |
| 165 bool save_original_selection) = 0; | 167 bool save_original_selection, |
| 168 bool notify_text_changed) = 0; |
| 166 | 169 |
| 167 // Called when the inline autocomplete text in the model may have changed. | 170 // Called when the inline autocomplete text in the model may have changed. |
| 168 // |display_text| is the new text to show; |user_text_length| is the length of | 171 // |display_text| is the new text to show; |user_text_length| is the length of |
| 169 // the user input portion of that (so, up to but not including the inline | 172 // the user input portion of that (so, up to but not including the inline |
| 170 // autocompletion). Returns whether the display text actually changed. | 173 // autocompletion). Returns whether the display text actually changed. |
| 171 virtual bool OnInlineAutocompleteTextMaybeChanged( | 174 virtual bool OnInlineAutocompleteTextMaybeChanged( |
| 172 const string16& display_text, size_t user_text_length) = 0; | 175 const string16& display_text, size_t user_text_length) = 0; |
| 173 | 176 |
| 174 // Called when the temporary text has been reverted by the user. This will | 177 // Called when the temporary text has been reverted by the user. This will |
| 175 // reset the user's original selection. | 178 // reset the user's original selection. |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 scoped_ptr<OmniboxEditModel> model_; | 261 scoped_ptr<OmniboxEditModel> model_; |
| 259 OmniboxEditController* controller_; | 262 OmniboxEditController* controller_; |
| 260 ToolbarModel* toolbar_model_; | 263 ToolbarModel* toolbar_model_; |
| 261 | 264 |
| 262 // The object that handles additional command functionality exposed on the | 265 // The object that handles additional command functionality exposed on the |
| 263 // edit, such as invoking the keyword editor. | 266 // edit, such as invoking the keyword editor. |
| 264 CommandUpdater* command_updater_; | 267 CommandUpdater* command_updater_; |
| 265 }; | 268 }; |
| 266 | 269 |
| 267 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ | 270 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |
| OLD | NEW |