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