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 // Sets focus, disables search term replacement, reverts the omnibox, and | |
134 // selects all. | |
135 void ShowURL(); | |
136 | |
137 // Enables search term replacement and reverts the omnibox. | |
138 void HideURL(); | |
139 | |
140 // Re-enables search term replacement on the ToolbarModel, and reverts the | 133 // Re-enables search term replacement on the ToolbarModel, and reverts the |
141 // edit and popup back to their unedited state (permanent text showing, popup | 134 // edit and popup back to their unedited state (permanent text showing, popup |
142 // closed, no user input in progress). | 135 // closed, no user input in progress). |
143 virtual void RevertAll(); | 136 virtual void RevertAll(); |
144 | 137 |
145 // Like RevertAll(), but does not touch the search term replacement state. | 138 // Like RevertAll(), but does not touch the search term replacement state. |
146 void RevertWithoutResettingSearchTermReplacement(); | 139 void RevertWithoutResettingSearchTermReplacement(); |
147 | 140 |
148 // Updates the autocomplete popup and other state after the text has been | 141 // Updates the autocomplete popup and other state after the text has been |
149 // changed by the user. | 142 // changed by the user. |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 virtual int GetOmniboxTextLength() const = 0; | 271 virtual int GetOmniboxTextLength() const = 0; |
279 | 272 |
280 // Try to parse the current text as a URL and colorize the components. | 273 // Try to parse the current text as a URL and colorize the components. |
281 virtual void EmphasizeURLComponents() = 0; | 274 virtual void EmphasizeURLComponents() = 0; |
282 | 275 |
283 OmniboxEditController* controller() { return controller_; } | 276 OmniboxEditController* controller() { return controller_; } |
284 const OmniboxEditController* controller() const { return controller_; } | 277 const OmniboxEditController* controller() const { return controller_; } |
285 | 278 |
286 private: | 279 private: |
287 friend class OmniboxViewMacTest; | 280 friend class OmniboxViewMacTest; |
288 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | |
289 | 281 |
290 // |model_| can be NULL in tests. | 282 // |model_| can be NULL in tests. |
291 std::unique_ptr<OmniboxEditModel> model_; | 283 std::unique_ptr<OmniboxEditModel> model_; |
292 OmniboxEditController* controller_; | 284 OmniboxEditController* controller_; |
293 | 285 |
294 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 286 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
295 }; | 287 }; |
296 | 288 |
297 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 289 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |