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 10 matching lines...) Expand all Loading... |
21 #include "components/omnibox/browser/omnibox_edit_model.h" | 21 #include "components/omnibox/browser/omnibox_edit_model.h" |
22 #include "ui/base/window_open_disposition.h" | 22 #include "ui/base/window_open_disposition.h" |
23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
24 | 24 |
25 class GURL; | 25 class GURL; |
26 class OmniboxClient; | 26 class OmniboxClient; |
27 class OmniboxEditController; | 27 class OmniboxEditController; |
28 class OmniboxViewMacTest; | 28 class OmniboxViewMacTest; |
29 class ToolbarModel; | 29 class ToolbarModel; |
30 | 30 |
| 31 namespace gfx { |
| 32 enum class VectorIconId; |
| 33 } |
| 34 |
31 class OmniboxView { | 35 class OmniboxView { |
32 public: | 36 public: |
33 virtual ~OmniboxView(); | 37 virtual ~OmniboxView(); |
34 | 38 |
35 // Used by the automation system for getting at the model from the view. | 39 // Used by the automation system for getting at the model from the view. |
36 OmniboxEditModel* model() { return model_.get(); } | 40 OmniboxEditModel* model() { return model_.get(); } |
37 const OmniboxEditModel* model() const { return model_.get(); } | 41 const OmniboxEditModel* model() const { return model_.get(); } |
38 | 42 |
39 // Shared cross-platform focus handling. | 43 // Shared cross-platform focus handling. |
40 void OnDidKillFocus(); | 44 void OnDidKillFocus(); |
(...skipping 23 matching lines...) Expand all Loading... |
64 // browser, or just whatever the user has currently typed. | 68 // browser, or just whatever the user has currently typed. |
65 virtual base::string16 GetText() const = 0; | 69 virtual base::string16 GetText() const = 0; |
66 | 70 |
67 // |true| if the user is in the process of editing the field, or if | 71 // |true| if the user is in the process of editing the field, or if |
68 // the field is empty. | 72 // the field is empty. |
69 bool IsEditingOrEmpty() const; | 73 bool IsEditingOrEmpty() const; |
70 | 74 |
71 // Returns the resource ID of the icon to show for the current text. | 75 // Returns the resource ID of the icon to show for the current text. |
72 int GetIcon() const; | 76 int GetIcon() const; |
73 | 77 |
| 78 // Like GetIcon(), but returns a vector icon identifier. |
| 79 gfx::VectorIconId GetVectorIcon() const; |
| 80 |
74 // The user text is the text the user has manually keyed in. When present, | 81 // The user text is the text the user has manually keyed in. When present, |
75 // this is shown in preference to the permanent text; hitting escape will | 82 // this is shown in preference to the permanent text; hitting escape will |
76 // revert to the permanent text. | 83 // revert to the permanent text. |
77 void SetUserText(const base::string16& text); | 84 void SetUserText(const base::string16& text); |
78 virtual void SetUserText(const base::string16& text, | 85 virtual void SetUserText(const base::string16& text, |
79 const base::string16& display_text, | 86 const base::string16& display_text, |
80 bool update_popup); | 87 bool update_popup); |
81 | 88 |
82 // Sets the window text and the caret position. |notify_text_changed| is true | 89 // Sets the window text and the caret position. |notify_text_changed| is true |
83 // if the model should be notified of the change. | 90 // if the model should be notified of the change. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); | 258 FRIEND_TEST_ALL_PREFIXES(InstantExtendedTest, ShowURL); |
252 | 259 |
253 // |model_| can be NULL in tests. | 260 // |model_| can be NULL in tests. |
254 scoped_ptr<OmniboxEditModel> model_; | 261 scoped_ptr<OmniboxEditModel> model_; |
255 OmniboxEditController* controller_; | 262 OmniboxEditController* controller_; |
256 | 263 |
257 DISALLOW_COPY_AND_ASSIGN(OmniboxView); | 264 DISALLOW_COPY_AND_ASSIGN(OmniboxView); |
258 }; | 265 }; |
259 | 266 |
260 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ | 267 #endif // COMPONENTS_OMNIBOX_BROWSER_OMNIBOX_VIEW_H_ |
OLD | NEW |