OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 10 #include <string> |
11 | 11 |
12 #include "app/gtk_signal.h" | 12 #include "app/gtk_signal.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/scoped_ptr.h" | 14 #include "base/scoped_ptr.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 16 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
17 #include "chrome/browser/toolbar_model.h" | 17 #include "chrome/browser/toolbar_model.h" |
18 #include "chrome/common/notification_observer.h" | 18 #include "chrome/common/notification_observer.h" |
19 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
20 #include "chrome/common/owned_widget_gtk.h" | 20 #include "chrome/common/owned_widget_gtk.h" |
21 #include "chrome/common/page_transition_types.h" | 21 #include "chrome/common/page_transition_types.h" |
22 #include "gfx/rect.h" | 22 #include "gfx/rect.h" |
23 #include "webkit/glue/window_open_disposition.h" | 23 #include "webkit/glue/window_open_disposition.h" |
24 | 24 |
25 class AutocompleteEditController; | 25 class AutocompleteEditController; |
26 class AutocompleteEditModel; | 26 class AutocompleteEditModel; |
27 class AutocompletePopupView; | 27 class AutocompletePopupView; |
28 class BubblePositioner; | |
29 class Profile; | 28 class Profile; |
30 class TabContents; | 29 class TabContents; |
| 30 namespace views { |
| 31 class View; |
| 32 } |
31 | 33 |
32 #if !defined(TOOLKIT_VIEWS) | 34 #if !defined(TOOLKIT_VIEWS) |
33 class GtkThemeProvider; | 35 class GtkThemeProvider; |
34 #endif | 36 #endif |
35 | 37 |
36 class AutocompleteEditViewGtk : public AutocompleteEditView, | 38 class AutocompleteEditViewGtk : public AutocompleteEditView, |
37 public NotificationObserver { | 39 public NotificationObserver { |
38 public: | 40 public: |
39 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position | 41 // Modeled like the Windows CHARRANGE. Represent a pair of cursor position |
40 // offsets. Since GtkTextIters are invalid after the buffer is changed, we | 42 // offsets. Since GtkTextIters are invalid after the buffer is changed, we |
41 // work in character offsets (not bytes). | 43 // work in character offsets (not bytes). |
42 struct CharRange { | 44 struct CharRange { |
43 CharRange() : cp_min(0), cp_max(0) { } | 45 CharRange() : cp_min(0), cp_max(0) { } |
44 CharRange(int n, int x) : cp_min(n), cp_max(x) { } | 46 CharRange(int n, int x) : cp_min(n), cp_max(x) { } |
45 | 47 |
46 // Work in integers to match the gint GTK APIs. | 48 // Work in integers to match the gint GTK APIs. |
47 int cp_min; // For a selection: Represents the start. | 49 int cp_min; // For a selection: Represents the start. |
48 int cp_max; // For a selection: Represents the end (insert position). | 50 int cp_max; // For a selection: Represents the end (insert position). |
49 }; | 51 }; |
50 | 52 |
51 AutocompleteEditViewGtk(AutocompleteEditController* controller, | 53 AutocompleteEditViewGtk(AutocompleteEditController* controller, |
52 ToolbarModel* toolbar_model, | 54 ToolbarModel* toolbar_model, |
53 Profile* profile, | 55 Profile* profile, |
54 CommandUpdater* command_updater, | 56 CommandUpdater* command_updater, |
55 bool popup_window_mode, | 57 bool popup_window_mode, |
56 const BubblePositioner* bubble_positioner); | 58 #if defined(TOOLKIT_VIEWS) |
| 59 const views::View* location_bar); |
| 60 #else |
| 61 const GtkWidget* location_bar); |
| 62 #endif |
57 ~AutocompleteEditViewGtk(); | 63 ~AutocompleteEditViewGtk(); |
58 | 64 |
59 // Initialize, create the underlying widgets, etc. | 65 // Initialize, create the underlying widgets, etc. |
60 void Init(); | 66 void Init(); |
61 | 67 |
62 // Returns the width, in pixels, needed to display the current text. The | 68 // Returns the width, in pixels, needed to display the current text. The |
63 // returned value includes margins and borders. | 69 // returned value includes margins and borders. |
64 int TextWidth(); | 70 int TextWidth(); |
65 | 71 |
66 // Implement the AutocompleteEditView interface. | 72 // Implement the AutocompleteEditView interface. |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 345 |
340 // Indicate if the tab to search should be enabled or not. It's true by | 346 // Indicate if the tab to search should be enabled or not. It's true by |
341 // default and will only be set to false if the location bar view is not able | 347 // default and will only be set to false if the location bar view is not able |
342 // to show the tab to search hint. | 348 // to show the tab to search hint. |
343 bool enable_tab_to_search_; | 349 bool enable_tab_to_search_; |
344 | 350 |
345 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); | 351 DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk); |
346 }; | 352 }; |
347 | 353 |
348 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ | 354 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_EDIT_VIEW_GTK_H_ |
OLD | NEW |