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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 // Fills |start| and |end| with the indexes of the current selection's bounds. | 128 // Fills |start| and |end| with the indexes of the current selection's bounds. |
129 // It is not guaranteed that |*start < *end|, as the selection can be | 129 // It is not guaranteed that |*start < *end|, as the selection can be |
130 // directed. If there is no selection, |start| and |end| will both be equal | 130 // directed. If there is no selection, |start| and |end| will both be equal |
131 // to the current cursor position. | 131 // to the current cursor position. |
132 virtual void GetSelectionBounds(size_t* start, size_t* end) const = 0; | 132 virtual void GetSelectionBounds(size_t* start, size_t* end) const = 0; |
133 | 133 |
134 // Selects all the text in the edit. Use this in place of SetSelAll() to | 134 // Selects all the text in the edit. Use this in place of SetSelAll() to |
135 // avoid selecting the "phantom newline" at the end of the edit. | 135 // avoid selecting the "phantom newline" at the end of the edit. |
136 virtual void SelectAll(bool reversed) = 0; | 136 virtual void SelectAll(bool reversed) = 0; |
137 | 137 |
138 // Sets focus, disables search term replacement, reverts the omnibox, and | |
msw
2013/12/12 00:59:21
Make sure the definition order matches this revise
Justin Donnelly
2013/12/12 17:11:57
Done.
| |
139 // selects all. | |
140 void ShowURL(); | |
141 | |
138 // Re-enables search term replacement on the ToolbarModel, and reverts the | 142 // Re-enables search term replacement on the ToolbarModel, and reverts the |
139 // edit and popup back to their unedited state (permanent text showing, popup | 143 // edit and popup back to their unedited state (permanent text showing, popup |
140 // closed, no user input in progress). | 144 // closed, no user input in progress). |
141 virtual void RevertAll(); | 145 virtual void RevertAll(); |
142 | 146 |
143 // Like RevertAll(), but does not touch the search term replacement state. | 147 // Like RevertAll(), but does not touch the search term replacement state. |
144 void RevertWithoutResettingSearchTermReplacement(); | 148 void RevertWithoutResettingSearchTermReplacement(); |
145 | 149 |
146 // Updates the autocomplete popup and other state after the text has been | 150 // Updates the autocomplete popup and other state after the text has been |
147 // changed by the user. | 151 // changed by the user. |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 static string16 GetClipboardText(); | 253 static string16 GetClipboardText(); |
250 | 254 |
251 protected: | 255 protected: |
252 OmniboxView(Profile* profile, | 256 OmniboxView(Profile* profile, |
253 OmniboxEditController* controller, | 257 OmniboxEditController* controller, |
254 CommandUpdater* command_updater); | 258 CommandUpdater* command_updater); |
255 | 259 |
256 // Internally invoked whenever the text changes in some way. | 260 // Internally invoked whenever the text changes in some way. |
257 virtual void TextChanged(); | 261 virtual void TextChanged(); |
258 | 262 |
259 // Disables search term replacement, reverts the omnibox, and selects all. | |
260 void ShowURL(); | |
261 | |
262 // Return the number of characters in the current buffer. The name | 263 // Return the number of characters in the current buffer. The name |
263 // |GetTextLength| can't be used as the Windows override of this class | 264 // |GetTextLength| can't be used as the Windows override of this class |
264 // inherits from a class that defines a method with that name. | 265 // inherits from a class that defines a method with that name. |
265 virtual int GetOmniboxTextLength() const = 0; | 266 virtual int GetOmniboxTextLength() const = 0; |
266 | 267 |
267 // Try to parse the current text as a URL and colorize the components. | 268 // Try to parse the current text as a URL and colorize the components. |
268 virtual void EmphasizeURLComponents() = 0; | 269 virtual void EmphasizeURLComponents() = 0; |
269 | 270 |
270 OmniboxEditController* controller() { return controller_; } | 271 OmniboxEditController* controller() { return controller_; } |
271 const OmniboxEditController* controller() const { return controller_; } | 272 const OmniboxEditController* controller() const { return controller_; } |
272 | 273 |
273 private: | 274 private: |
274 friend class OmniboxViewMacTest; | 275 friend class OmniboxViewMacTest; |
275 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 276 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
276 | 277 |
277 // |model_| can be NULL in tests. | 278 // |model_| can be NULL in tests. |
278 scoped_ptr<OmniboxEditModel> model_; | 279 scoped_ptr<OmniboxEditModel> model_; |
279 OmniboxEditController* controller_; | 280 OmniboxEditController* controller_; |
280 | 281 |
281 // The object that handles additional command functionality exposed on the | 282 // The object that handles additional command functionality exposed on the |
282 // edit, such as invoking the keyword editor. | 283 // edit, such as invoking the keyword editor. |
283 CommandUpdater* command_updater_; | 284 CommandUpdater* command_updater_; |
284 }; | 285 }; |
285 | 286 |
286 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ | 287 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |
OLD | NEW |