| 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 // Sets the caret position. |
| 102 // if the edit is not in forced query mode, its text is set to "?" with the | 102 virtual void SetCaretPos(size_t caret_pos) = 0; |
| 103 // cursor at the end, and if the edit is in forced query mode (its first | 103 |
| 104 // non-whitespace character is '?'), the text after the '?' is selected. | 104 // Transitions the user into keyword mode with their default search provider, |
| 105 // | 105 // preserving and selecting the user's text if they already typed in a query. |
| 106 // In the future we should display the search engine UI for the default engine | 106 virtual void EnterKeywordModeForDefaultSearchProvider() = 0; |
| 107 // rather than '?'. | |
| 108 virtual void SetForcedQuery() = 0; | |
| 109 | 107 |
| 110 // Returns true if all text is selected or there is no text at all. | 108 // Returns true if all text is selected or there is no text at all. |
| 111 virtual bool IsSelectAll() const = 0; | 109 virtual bool IsSelectAll() const = 0; |
| 112 | 110 |
| 113 // Returns true if the user deleted the suggested text. | 111 // Returns true if the user deleted the suggested text. |
| 114 virtual bool DeleteAtEndPressed() = 0; | 112 virtual bool DeleteAtEndPressed() = 0; |
| 115 | 113 |
| 116 // Fills |start| and |end| with the indexes of the current selection's bounds. | 114 // 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 | 115 // 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 | 116 // 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); | 262 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
| 265 | 263 |
| 266 // |model_| can be NULL in tests. | 264 // |model_| can be NULL in tests. |
| 267 std::unique_ptr<OmniboxEditModel> model_; | 265 std::unique_ptr<OmniboxEditModel> model_; |
| 268 OmniboxEditController* controller_; | 266 OmniboxEditController* controller_; |
| 269 | 267 |
| 270 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 268 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
| 271 }; | 269 }; |
| 272 | 270 |
| 273 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 271 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
| OLD | NEW |