OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
7 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 13 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
14 #include "chrome/browser/toolbar_model.h" | 14 #include "chrome/browser/toolbar_model.h" |
15 #include "chrome/common/owned_widget_gtk.h" | 15 #include "chrome/common/owned_widget_gtk.h" |
16 #include "chrome/common/page_transition_types.h" | 16 #include "chrome/common/page_transition_types.h" |
17 #include "webkit/glue/window_open_disposition.h" | 17 #include "webkit/glue/window_open_disposition.h" |
18 | 18 |
19 class AutocompleteEditController; | 19 class AutocompleteEditController; |
20 class AutocompleteEditModel; | 20 class AutocompleteEditModel; |
21 class AutocompletePopupPositioner; | 21 class AutocompletePopupPositioner; |
22 class AutocompletePopupViewGtk; | 22 class AutocompletePopupView; |
23 class CommandUpdater; | 23 class CommandUpdater; |
24 class Profile; | 24 class Profile; |
25 class TabContents; | 25 class TabContents; |
26 | 26 |
27 class AutocompleteEditViewGtk : public AutocompleteEditView { | 27 class AutocompleteEditViewGtk : public AutocompleteEditView { |
28 public: | 28 public: |
29 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position | 29 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position |
30 // offsets. Since GtkTextIters are invalid after the buffer is changed, we | 30 // offsets. Since GtkTextIters are invalid after the buffer is changed, we |
31 // work in character offsets (not bytes). | 31 // work in character offsets (not bytes). |
32 struct CharRange { | 32 struct CharRange { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 virtual void UpdatePopup(); | 90 virtual void UpdatePopup(); |
91 virtual void ClosePopup(); | 91 virtual void ClosePopup(); |
92 | 92 |
93 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, | 93 virtual void OnTemporaryTextMaybeChanged(const std::wstring& display_text, |
94 bool save_original_selection); | 94 bool save_original_selection); |
95 virtual bool OnInlineAutocompleteTextMaybeChanged( | 95 virtual bool OnInlineAutocompleteTextMaybeChanged( |
96 const std::wstring& display_text, size_t user_text_length); | 96 const std::wstring& display_text, size_t user_text_length); |
97 virtual void OnRevertTemporaryText(); | 97 virtual void OnRevertTemporaryText(); |
98 virtual void OnBeforePossibleChange(); | 98 virtual void OnBeforePossibleChange(); |
99 virtual bool OnAfterPossibleChange(); | 99 virtual bool OnAfterPossibleChange(); |
| 100 virtual gfx::NativeView GetNativeView() const; |
100 | 101 |
101 private: | 102 private: |
102 // TODO(deanm): Would be nice to insulate the thunkers better, etc. | 103 // TODO(deanm): Would be nice to insulate the thunkers better, etc. |
103 static void HandleBeginUserActionThunk(GtkTextBuffer* unused, gpointer self) { | 104 static void HandleBeginUserActionThunk(GtkTextBuffer* unused, gpointer self) { |
104 reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleBeginUserAction(); | 105 reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleBeginUserAction(); |
105 } | 106 } |
106 void HandleBeginUserAction(); | 107 void HandleBeginUserAction(); |
107 | 108 |
108 static void HandleEndUserActionThunk(GtkTextBuffer* unused, gpointer self) { | 109 static void HandleEndUserActionThunk(GtkTextBuffer* unused, gpointer self) { |
109 reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleEndUserAction(); | 110 reinterpret_cast<AutocompleteEditViewGtk*>(self)->HandleEndUserAction(); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 GtkWidget* text_view_; | 266 GtkWidget* text_view_; |
266 | 267 |
267 GtkTextTagTable* tag_table_; | 268 GtkTextTagTable* tag_table_; |
268 GtkTextBuffer* text_buffer_; | 269 GtkTextBuffer* text_buffer_; |
269 GtkTextTag* base_tag_; | 270 GtkTextTag* base_tag_; |
270 GtkTextTag* secure_scheme_tag_; | 271 GtkTextTag* secure_scheme_tag_; |
271 GtkTextTag* insecure_scheme_tag_; | 272 GtkTextTag* insecure_scheme_tag_; |
272 GtkTextTag* black_text_tag_; | 273 GtkTextTag* black_text_tag_; |
273 | 274 |
274 scoped_ptr<AutocompleteEditModel> model_; | 275 scoped_ptr<AutocompleteEditModel> model_; |
275 scoped_ptr<AutocompletePopupViewGtk> popup_view_; | 276 scoped_ptr<AutocompletePopupView> popup_view_; |
276 AutocompleteEditController* controller_; | 277 AutocompleteEditController* controller_; |
277 ToolbarModel* toolbar_model_; | 278 ToolbarModel* toolbar_model_; |
278 | 279 |
279 // The object that handles additional command functionality exposed on the | 280 // The object that handles additional command functionality exposed on the |
280 // edit, such as invoking the keyword editor. | 281 // edit, such as invoking the keyword editor. |
281 CommandUpdater* command_updater_; | 282 CommandUpdater* command_updater_; |
282 | 283 |
283 // When true, the location bar view is read only and also is has a slightly | 284 // When true, the location bar view is read only and also is has a slightly |
284 // different presentation (smaller font size). This is used for popups. | 285 // different presentation (smaller font size). This is used for popups. |
285 bool popup_window_mode_; | 286 bool popup_window_mode_; |
(...skipping 28 matching lines...) Expand all Loading... |
314 | 315 |
315 // Was the text view already focused before the user clicked in it? We use | 316 // Was the text view already focused before the user clicked in it? We use |
316 // this to figure out whether we should select all of the text when the button | 317 // this to figure out whether we should select all of the text when the button |
317 // is released (we only do so if the view was initially unfocused). | 318 // is released (we only do so if the view was initially unfocused). |
318 bool text_view_focused_before_button_press_; | 319 bool text_view_focused_before_button_press_; |
319 | 320 |
320 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); | 321 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); |
321 }; | 322 }; |
322 | 323 |
323 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 324 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
OLD | NEW |