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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Fills |start| and |end| with the indexes of the current selection's bounds. | 123 // Fills |start| and |end| with the indexes of the current selection's bounds. |
124 // It is not guaranteed that |*start < *end|, as the selection can be | 124 // It is not guaranteed that |*start < *end|, as the selection can be |
125 // directed. If there is no selection, |start| and |end| will both be equal | 125 // directed. If there is no selection, |start| and |end| will both be equal |
126 // to the current cursor position. | 126 // to the current cursor position. |
127 virtual void GetSelectionBounds(size_t* start, size_t* end) const = 0; | 127 virtual void GetSelectionBounds(size_t* start, size_t* end) const = 0; |
128 | 128 |
129 // Selects all the text in the edit. Use this in place of SetSelAll() to | 129 // Selects all the text in the edit. Use this in place of SetSelAll() to |
130 // avoid selecting the "phantom newline" at the end of the edit. | 130 // avoid selecting the "phantom newline" at the end of the edit. |
131 virtual void SelectAll(bool reversed) = 0; | 131 virtual void SelectAll(bool reversed) = 0; |
132 | 132 |
133 // Re-enables search term replacement on the ToolbarModel, and reverts the | 133 // Reverts the edit and popup back to their unedited state (permanent text |
134 // edit and popup back to their unedited state (permanent text showing, popup | 134 // showing, popup closed, no user input in progress). |
135 // closed, no user input in progress). | |
136 virtual void RevertAll(); | 135 virtual void RevertAll(); |
137 | 136 |
138 // Like RevertAll(), but does not touch the search term replacement state. | |
139 void RevertWithoutResettingSearchTermReplacement(); | |
140 | |
141 // Updates the autocomplete popup and other state after the text has been | 137 // Updates the autocomplete popup and other state after the text has been |
142 // changed by the user. | 138 // changed by the user. |
143 virtual void UpdatePopup() = 0; | 139 virtual void UpdatePopup() = 0; |
144 | 140 |
145 // Closes the autocomplete popup, if it's open. The name |ClosePopup| | 141 // Closes the autocomplete popup, if it's open. The name |ClosePopup| |
146 // conflicts with the OSX class override as that has a base class that also | 142 // conflicts with the OSX class override as that has a base class that also |
147 // defines a method with that name. | 143 // defines a method with that name. |
148 virtual void CloseOmniboxPopup(); | 144 virtual void CloseOmniboxPopup(); |
149 | 145 |
150 // Sets the focus to the autocomplete view. | 146 // Sets the focus to the autocomplete view. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 friend class OmniboxViewMacTest; | 276 friend class OmniboxViewMacTest; |
281 | 277 |
282 // |model_| can be NULL in tests. | 278 // |model_| can be NULL in tests. |
283 std::unique_ptr<OmniboxEditModel> model_; | 279 std::unique_ptr<OmniboxEditModel> model_; |
284 OmniboxEditController* controller_; | 280 OmniboxEditController* controller_; |
285 | 281 |
286 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 282 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
287 }; | 283 }; |
288 | 284 |
289 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 285 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |