OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "chrome/browser/autocomplete/autocomplete_match.h" | 13 #include "chrome/browser/autocomplete/autocomplete_match.h" |
14 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 14 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
15 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 15 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
16 #include "content/common/notification_observer.h" | 16 #include "content/common/notification_observer.h" |
17 #include "content/common/page_transition_types.h" | 17 #include "content/common/page_transition_types.h" |
18 #include "ui/base/range/range.h" | 18 #include "ui/base/range/range.h" |
19 #include "views/controls/textfield/textfield_controller.h" | 19 #include "views/controls/textfield/textfield_controller.h" |
20 #include "views/view.h" | 20 #include "views/view.h" |
21 #include "webkit/glue/window_open_disposition.h" | 21 #include "webkit/glue/window_open_disposition.h" |
22 | 22 |
23 class AutocompleteEditController; | 23 class AutocompleteEditController; |
24 class AutocompleteEditModel; | 24 class AutocompleteEditModel; |
25 class AutocompletePopupView; | 25 class AutocompletePopupView; |
26 class Profile; | 26 class Profile; |
27 class TabContents; | 27 class TabContents; |
28 | 28 |
29 namespace views { | |
30 class TextStyle; | |
31 } | |
32 | |
33 // Views-implementation of OmniboxView. This is based on gtk implementation. | 29 // Views-implementation of OmniboxView. This is based on gtk implementation. |
34 // The following features are not yet supported. | 30 // The following features are not yet supported. |
35 // | 31 // |
36 // LTR support. | 32 // LTR support. |
37 // Drag and drop behavior. | 33 // Drag and drop behavior. |
38 // Adjust paste behavior (should not autocomplete). | 34 // Adjust paste behavior (should not autocomplete). |
39 // Custom context menu for omnibox. | 35 // Custom context menu for omnibox. |
40 // Instant. | 36 // Instant. |
41 class OmniboxViewViews : public views::View, | 37 class OmniboxViewViews : public views::View, |
42 public OmniboxView, | 38 public OmniboxView, |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 152 |
157 // Returns the selected text. | 153 // Returns the selected text. |
158 string16 GetSelectedText() const; | 154 string16 GetSelectedText() const; |
159 | 155 |
160 // Selects the text given by |caret| and |end|. | 156 // Selects the text given by |caret| and |end|. |
161 void SelectRange(size_t caret, size_t end); | 157 void SelectRange(size_t caret, size_t end); |
162 | 158 |
163 AutocompletePopupView* CreatePopupView(Profile* profile, | 159 AutocompletePopupView* CreatePopupView(Profile* profile, |
164 const View* location_bar); | 160 const View* location_bar); |
165 | 161 |
166 // Lazy initialization of TextStyle objects. They can not be | |
167 // initialized in Init as native wrapper isn't available at that time. | |
168 void InitTextStyles(); | |
169 | |
170 views::Textfield* textfield_; | 162 views::Textfield* textfield_; |
171 | 163 |
172 scoped_ptr<AutocompleteEditModel> model_; | 164 scoped_ptr<AutocompleteEditModel> model_; |
173 scoped_ptr<AutocompletePopupView> popup_view_; | 165 scoped_ptr<AutocompletePopupView> popup_view_; |
174 AutocompleteEditController* controller_; | 166 AutocompleteEditController* controller_; |
175 ToolbarModel* toolbar_model_; | 167 ToolbarModel* toolbar_model_; |
176 | 168 |
177 // The object that handles additional command functionality exposed on the | 169 // The object that handles additional command functionality exposed on the |
178 // edit, such as invoking the keyword editor. | 170 // edit, such as invoking the keyword editor. |
179 CommandUpdater* command_updater_; | 171 CommandUpdater* command_updater_; |
180 | 172 |
181 // When true, the location bar view is read only and also is has a slightly | 173 // When true, the location bar view is read only and also is has a slightly |
182 // different presentation (smaller font size). This is used for popups. | 174 // different presentation (smaller font size). This is used for popups. |
183 bool popup_window_mode_; | 175 bool popup_window_mode_; |
184 | 176 |
185 ToolbarModel::SecurityLevel security_level_; | 177 ToolbarModel::SecurityLevel security_level_; |
186 | 178 |
187 // Selection at the point where the user started using the | 179 // Selection at the point where the user started using the |
188 // arrows to move around in the popup. | 180 // arrows to move around in the popup. |
189 ui::Range saved_temporary_selection_; | 181 ui::Range saved_temporary_selection_; |
190 | 182 |
191 // Tracking state before and after a possible change. | 183 // Tracking state before and after a possible change. |
192 string16 text_before_change_; | 184 string16 text_before_change_; |
193 ui::Range sel_before_change_; | 185 ui::Range sel_before_change_; |
194 bool ime_composing_before_change_; | 186 bool ime_composing_before_change_; |
195 | 187 |
196 // Was the delete key pressed with an empty selection at the end of the edit? | 188 // Was the delete key pressed with an empty selection at the end of the edit? |
197 bool delete_at_end_pressed_; | 189 bool delete_at_end_pressed_; |
198 | 190 |
199 // TextStyles for URL decoration. They're owned by textfield_. | |
200 views::TextStyle* faded_text_style_; | |
201 views::TextStyle* normal_text_style_; | |
202 views::TextStyle* security_error_scheme_style_; | |
203 views::TextStyle* secure_scheme_style_; | |
204 | |
205 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); | 191 DISALLOW_COPY_AND_ASSIGN(OmniboxViewViews); |
206 }; | 192 }; |
207 | 193 |
208 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ | 194 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_VIEWS_H_ |
OLD | NEW |