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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
91 const base::string16& display_text, | 91 const base::string16& display_text, |
92 bool update_popup); | 92 bool update_popup); |
93 | 93 |
94 // Sets the window text and the caret position. |notify_text_changed| is true | 94 // Sets the window text and the caret position. |notify_text_changed| is true |
95 // if the model should be notified of the change. | 95 // if the model should be notified of the change. |
96 virtual void SetWindowTextAndCaretPos(const base::string16& text, | 96 virtual void SetWindowTextAndCaretPos(const base::string16& text, |
97 size_t caret_pos, | 97 size_t caret_pos, |
98 bool update_popup, | 98 bool update_popup, |
99 bool notify_text_changed) = 0; | 99 bool notify_text_changed) = 0; |
100 | 100 |
101 // Sets the edit to forced query mode. Practically speaking, this means that | 101 // Transitions the user into keyword mode with their default search provider, |
102 // if the edit is not in forced query mode, its text is set to "?" with the | 102 // preserving the user's text if they already typed in a query. Selects the |
103 // cursor at the end, and if the edit is in forced query mode (its first | 103 // user's text if they're already in keyword mode. |
Peter Kasting
2016/04/13 02:52:16
Doesn't this select the text regardless? (Which i
Tom (Use chromium acct)
2016/04/13 23:37:41
Done.
| |
104 // non-whitespace character is '?'), the text after the '?' is selected. | |
105 // | |
106 // In the future we should display the search engine UI for the default engine | |
107 // rather than '?'. | |
108 virtual void SetForcedQuery() = 0; | 104 virtual void SetForcedQuery() = 0; |
Peter Kasting
2016/04/13 02:52:16
Nit: This function name should be changed as "forc
Tom (Use chromium acct)
2016/04/13 23:37:41
I Agree. Done.
| |
109 | 105 |
110 // Returns true if all text is selected or there is no text at all. | 106 // Returns true if all text is selected or there is no text at all. |
111 virtual bool IsSelectAll() const = 0; | 107 virtual bool IsSelectAll() const = 0; |
112 | 108 |
113 // Returns true if the user deleted the suggested text. | 109 // Returns true if the user deleted the suggested text. |
114 virtual bool DeleteAtEndPressed() = 0; | 110 virtual bool DeleteAtEndPressed() = 0; |
115 | 111 |
116 // Fills |start| and |end| with the indexes of the current selection's bounds. | 112 // Fills |start| and |end| with the indexes of the current selection's bounds. |
117 // It is not guaranteed that |*start < *end|, as the selection can be | 113 // It is not guaranteed that |*start < *end|, as the selection can be |
118 // directed. If there is no selection, |start| and |end| will both be equal | 114 // directed. If there is no selection, |start| and |end| will both be equal |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 260 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
265 | 261 |
266 // |model_| can be NULL in tests. | 262 // |model_| can be NULL in tests. |
267 scoped_ptr<OmniboxEditModel> model_; | 263 scoped_ptr<OmniboxEditModel> model_; |
268 OmniboxEditController* controller_; | 264 OmniboxEditController* controller_; |
269 | 265 |
270 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 266 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
271 }; | 267 }; |
272 | 268 |
273 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 269 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |