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 // Transition the user into keyword mode with their default search provider. |
Peter Kasting
2016/04/08 00:39:56
Nit: Function comments should be declarative, not
Tom (Use chromium acct)
2016/04/12 20:03:05
Done.
| |
102 // if the edit is not in forced query mode, its text is set to "?" with the | 102 // If the user has already typed some text, preserve it in the query. If the |
103 // cursor at the end, and if the edit is in forced query mode (its first | 103 // user is already in keyword mode (with any search provider), select their |
104 // non-whitespace character is '?'), the text after the '?' is selected. | 104 // query. |
105 // | |
106 // In the future we should display the search engine UI for the default engine | |
107 // rather than '?'. | |
108 virtual void SetForcedQuery() = 0; | 105 virtual void SetForcedQuery() = 0; |
109 | 106 |
110 // Returns true if all text is selected or there is no text at all. | 107 // Returns true if all text is selected or there is no text at all. |
111 virtual bool IsSelectAll() const = 0; | 108 virtual bool IsSelectAll() const = 0; |
112 | 109 |
113 // Returns true if the user deleted the suggested text. | 110 // Returns true if the user deleted the suggested text. |
114 virtual bool DeleteAtEndPressed() = 0; | 111 virtual bool DeleteAtEndPressed() = 0; |
115 | 112 |
116 // Fills |start| and |end| with the indexes of the current selection's bounds. | 113 // 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 | 114 // It is not guaranteed that |*start < *end|, as the selection can be |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
264 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 261 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
265 | 262 |
266 // |model_| can be NULL in tests. | 263 // |model_| can be NULL in tests. |
267 scoped_ptr<OmniboxEditModel> model_; | 264 scoped_ptr<OmniboxEditModel> model_; |
268 OmniboxEditController* controller_; | 265 OmniboxEditController* controller_; |
269 | 266 |
270 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 267 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
271 }; | 268 }; |
272 | 269 |
273 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 270 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |