| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 virtual void SetUserText(const base::string16& text, | 90 virtual void SetUserText(const base::string16& text, |
| 91 bool update_popup); | 91 bool update_popup); |
| 92 | 92 |
| 93 // Sets the window text and the caret position. |notify_text_changed| is true | 93 // Sets the window text and the caret position. |notify_text_changed| is true |
| 94 // if the model should be notified of the change. | 94 // if the model should be notified of the change. |
| 95 virtual void SetWindowTextAndCaretPos(const base::string16& text, | 95 virtual void SetWindowTextAndCaretPos(const base::string16& text, |
| 96 size_t caret_pos, | 96 size_t caret_pos, |
| 97 bool update_popup, | 97 bool update_popup, |
| 98 bool notify_text_changed) = 0; | 98 bool notify_text_changed) = 0; |
| 99 | 99 |
| 100 // Sets the edit to forced query mode. Practically speaking, this means that | 100 // Transitions the user into keyword mode with their default search provider, |
| 101 // if the edit is not in forced query mode, its text is set to "?" with the | 101 // preserving and selecting the user's text if they already typed in a query. |
| 102 // cursor at the end, and if the edit is in forced query mode (its first | 102 virtual void EnterKeywordModeForDefaultSearchProvider() = 0; |
| 103 // non-whitespace character is '?'), the text after the '?' is selected. | |
| 104 // | |
| 105 // In the future we should display the search engine UI for the default engine | |
| 106 // rather than '?'. | |
| 107 virtual void SetForcedQuery() = 0; | |
| 108 | 103 |
| 109 // Returns true if all text is selected or there is no text at all. | 104 // Returns true if all text is selected or there is no text at all. |
| 110 virtual bool IsSelectAll() const = 0; | 105 virtual bool IsSelectAll() const = 0; |
| 111 | 106 |
| 112 // Returns true if the user deleted the suggested text. | 107 // Returns true if the user deleted the suggested text. |
| 113 virtual bool DeleteAtEndPressed() = 0; | 108 virtual bool DeleteAtEndPressed() = 0; |
| 114 | 109 |
| 115 // Fills |start| and |end| with the indexes of the current selection's bounds. | 110 // Fills |start| and |end| with the indexes of the current selection's bounds. |
| 116 // It is not guaranteed that |*start < *end|, as the selection can be | 111 // It is not guaranteed that |*start < *end|, as the selection can be |
| 117 // directed. If there is no selection, |start| and |end| will both be equal | 112 // 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... |
| 263 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 258 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
| 264 | 259 |
| 265 // |model_| can be NULL in tests. | 260 // |model_| can be NULL in tests. |
| 266 std::unique_ptr<OmniboxEditModel> model_; | 261 std::unique_ptr<OmniboxEditModel> model_; |
| 267 OmniboxEditController* controller_; | 262 OmniboxEditController* controller_; |
| 268 | 263 |
| 269 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 264 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
| 270 }; | 265 }; |
| 271 | 266 |
| 272 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 267 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
| OLD | NEW |