| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 // Called when the window's active tab changes. | 54 // Called when the window's active tab changes. |
| 55 virtual void OnTabChanged(const content::WebContents* web_contents) = 0; | 55 virtual void OnTabChanged(const content::WebContents* web_contents) = 0; |
| 56 | 56 |
| 57 // Called to clear the saved state for |web_contents|. | 57 // Called to clear the saved state for |web_contents|. |
| 58 virtual void ResetTabState(content::WebContents* web_contents) = 0; | 58 virtual void ResetTabState(content::WebContents* web_contents) = 0; |
| 59 | 59 |
| 60 // Called when any relevant state changes other than changing tabs. | 60 // Called when any relevant state changes other than changing tabs. |
| 61 virtual void Update() = 0; | 61 virtual void Update() = 0; |
| 62 | 62 |
| 63 // Updates the placeholder text with the value of GetHintText() if hint texts | |
| 64 // are enabled. | |
| 65 virtual void UpdatePlaceholderText() = 0; | |
| 66 | |
| 67 // Asks the browser to load the specified match, using the supplied | 63 // Asks the browser to load the specified match, using the supplied |
| 68 // disposition. |alternate_nav_url|, if non-empty, contains the | 64 // disposition. |alternate_nav_url|, if non-empty, contains the |
| 69 // alternate navigation URL for for this match. See comments on | 65 // alternate navigation URL for for this match. See comments on |
| 70 // AutocompleteResult::GetAlternateNavURL(). | 66 // AutocompleteResult::GetAlternateNavURL(). |
| 71 // | 67 // |
| 72 // |pasted_text| should only be set if this call is due to a | 68 // |pasted_text| should only be set if this call is due to a |
| 73 // Paste-And-Go/Search action. | 69 // Paste-And-Go/Search action. |
| 74 // | 70 // |
| 75 // |selected_line| is passed to SendOpenNotification(); see comments there. | 71 // |selected_line| is passed to SendOpenNotification(); see comments there. |
| 76 // | 72 // |
| 77 // This may close the popup. | 73 // This may close the popup. |
| 78 virtual void OpenMatch(const AutocompleteMatch& match, | 74 virtual void OpenMatch(const AutocompleteMatch& match, |
| 79 WindowOpenDisposition disposition, | 75 WindowOpenDisposition disposition, |
| 80 const GURL& alternate_nav_url, | 76 const GURL& alternate_nav_url, |
| 81 const base::string16& pasted_text, | 77 const base::string16& pasted_text, |
| 82 size_t selected_line); | 78 size_t selected_line); |
| 83 | 79 |
| 84 // Returns the current text of the edit control, which could be the | 80 // Returns the current text of the edit control, which could be the |
| 85 // "temporary" text set by the popup, the "permanent" text set by the | 81 // "temporary" text set by the popup, the "permanent" text set by the |
| 86 // browser, or just whatever the user has currently typed. | 82 // browser, or just whatever the user has currently typed. |
| 87 virtual base::string16 GetText() const = 0; | 83 virtual base::string16 GetText() const = 0; |
| 88 | 84 |
| 89 // |true| if the user is in the process of editing the field, or if | 85 // |true| if the user is in the process of editing the field, or if |
| 90 // the field is empty. | 86 // the field is empty. |
| 91 bool IsEditingOrEmpty() const; | 87 bool IsEditingOrEmpty() const; |
| 92 | 88 |
| 93 // Returns the resource ID of the icon to show for the current text. | 89 // Returns the resource ID of the icon to show for the current text. |
| 94 int GetIcon() const; | 90 int GetIcon() const; |
| 95 | 91 |
| 96 // Returns the hint text that should be displayed when there is no text in the | |
| 97 // omnibox. In keyword mode, this is an empty string. Otherwise, it's | |
| 98 // instructions to search the user's default search engine or type a URL. | |
| 99 base::string16 GetHintText() const; | |
| 100 | |
| 101 // The user text is the text the user has manually keyed in. When present, | 92 // The user text is the text the user has manually keyed in. When present, |
| 102 // this is shown in preference to the permanent text; hitting escape will | 93 // this is shown in preference to the permanent text; hitting escape will |
| 103 // revert to the permanent text. | 94 // revert to the permanent text. |
| 104 void SetUserText(const base::string16& text); | 95 void SetUserText(const base::string16& text); |
| 105 virtual void SetUserText(const base::string16& text, | 96 virtual void SetUserText(const base::string16& text, |
| 106 const base::string16& display_text, | 97 const base::string16& display_text, |
| 107 bool update_popup); | 98 bool update_popup); |
| 108 | 99 |
| 109 // Sets the window text and the caret position. |notify_text_changed| is true | 100 // Sets the window text and the caret position. |notify_text_changed| is true |
| 110 // if the model should be notified of the change. | 101 // if the model should be notified of the change. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 // |model_| can be NULL in tests. | 279 // |model_| can be NULL in tests. |
| 289 scoped_ptr<OmniboxEditModel> model_; | 280 scoped_ptr<OmniboxEditModel> model_; |
| 290 OmniboxEditController* controller_; | 281 OmniboxEditController* controller_; |
| 291 | 282 |
| 292 // The object that handles additional command functionality exposed on the | 283 // The object that handles additional command functionality exposed on the |
| 293 // edit, such as invoking the keyword editor. | 284 // edit, such as invoking the keyword editor. |
| 294 CommandUpdater* command_updater_; | 285 CommandUpdater* command_updater_; |
| 295 }; | 286 }; |
| 296 | 287 |
| 297 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ | 288 #endif // CHROME_BROWSER_UI_OMNIBOX_OMNIBOX_VIEW_H_ |
| OLD | NEW |