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_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
6 #define CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "ui/base/gtk/gtk_signal.h" | 21 #include "ui/base/gtk/gtk_signal.h" |
22 #include "ui/gfx/font.h" | 22 #include "ui/gfx/font.h" |
23 #include "webkit/glue/window_open_disposition.h" | 23 #include "webkit/glue/window_open_disposition.h" |
24 | 24 |
25 class AutocompleteEditModel; | 25 class AutocompleteEditModel; |
26 class AutocompletePopupModel; | 26 class AutocompletePopupModel; |
27 class GtkThemeService; | 27 class GtkThemeService; |
28 class OmniboxView; | 28 class OmniboxView; |
29 class SkBitmap; | 29 class SkBitmap; |
30 | 30 |
| 31 namespace gfx { |
| 32 class Image; |
| 33 } |
| 34 |
31 class OmniboxPopupViewGtk : public AutocompletePopupView, | 35 class OmniboxPopupViewGtk : public AutocompletePopupView, |
32 public content::NotificationObserver { | 36 public content::NotificationObserver { |
33 public: | 37 public: |
34 OmniboxPopupViewGtk(const gfx::Font& font, | 38 OmniboxPopupViewGtk(const gfx::Font& font, |
35 OmniboxView* omnibox_view, | 39 OmniboxView* omnibox_view, |
36 AutocompleteEditModel* edit_model, | 40 AutocompleteEditModel* edit_model, |
37 GtkWidget* location_bar); | 41 GtkWidget* location_bar); |
38 virtual ~OmniboxPopupViewGtk(); | 42 virtual ~OmniboxPopupViewGtk(); |
39 | 43 |
40 // Overridden from AutocompletePopupView: | 44 // Overridden from AutocompletePopupView: |
(...skipping 27 matching lines...) Expand all Loading... |
68 | 72 |
69 // Restack the popup window directly above the browser's toplevel window. | 73 // Restack the popup window directly above the browser's toplevel window. |
70 void StackWindow(); | 74 void StackWindow(); |
71 | 75 |
72 // Convert a y-coordinate to the closest line / result. | 76 // Convert a y-coordinate to the closest line / result. |
73 size_t LineFromY(int y); | 77 size_t LineFromY(int y); |
74 | 78 |
75 // Accept a line of the results, for example, when the user clicks a line. | 79 // Accept a line of the results, for example, when the user clicks a line. |
76 void AcceptLine(size_t line, WindowOpenDisposition disposition); | 80 void AcceptLine(size_t line, WindowOpenDisposition disposition); |
77 | 81 |
78 GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected); | 82 const gfx::Image* IconForMatch(const AutocompleteMatch& match, bool selected); |
79 | 83 |
80 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleMotion, | 84 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleMotion, |
81 GdkEventMotion*); | 85 GdkEventMotion*); |
82 | 86 |
83 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleButtonPress, | 87 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleButtonPress, |
84 GdkEventButton*); | 88 GdkEventButton*); |
85 | 89 |
86 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleButtonRelease, | 90 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleButtonRelease, |
87 GdkEventButton*); | 91 GdkEventButton*); |
88 | 92 |
(...skipping 12 matching lines...) Expand all Loading... |
101 | 105 |
102 GtkThemeService* theme_service_; | 106 GtkThemeService* theme_service_; |
103 content::NotificationRegistrar registrar_; | 107 content::NotificationRegistrar registrar_; |
104 | 108 |
105 // Font used for suggestions after being derived from the constructor's | 109 // Font used for suggestions after being derived from the constructor's |
106 // |font|. | 110 // |font|. |
107 gfx::Font font_; | 111 gfx::Font font_; |
108 | 112 |
109 // Used to cache GdkPixbufs and map them from the SkBitmaps they were created | 113 // Used to cache GdkPixbufs and map them from the SkBitmaps they were created |
110 // from. | 114 // from. |
111 typedef std::map<const SkBitmap*, GdkPixbuf*> PixbufMap; | 115 typedef std::map<const SkBitmap*, gfx::Image*> ImageMap; |
112 PixbufMap pixbufs_; | 116 ImageMap images_; |
113 | 117 |
114 // A list of colors which we should use for drawing the popup. These change | 118 // A list of colors which we should use for drawing the popup. These change |
115 // between gtk and normal mode. | 119 // between gtk and normal mode. |
116 GdkColor border_color_; | 120 GdkColor border_color_; |
117 GdkColor background_color_; | 121 GdkColor background_color_; |
118 GdkColor selected_background_color_; | 122 GdkColor selected_background_color_; |
119 GdkColor hovered_background_color_; | 123 GdkColor hovered_background_color_; |
120 GdkColor content_text_color_; | 124 GdkColor content_text_color_; |
121 GdkColor selected_content_text_color_; | 125 GdkColor selected_content_text_color_; |
122 GdkColor content_dim_text_color_; | 126 GdkColor content_dim_text_color_; |
123 GdkColor selected_content_dim_text_color_; | 127 GdkColor selected_content_dim_text_color_; |
124 GdkColor url_text_color_; | 128 GdkColor url_text_color_; |
125 GdkColor url_selected_text_color_; | 129 GdkColor url_selected_text_color_; |
126 | 130 |
127 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have | 131 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have |
128 // a convenient way to release mouse capture. Instead we use this flag to | 132 // a convenient way to release mouse capture. Instead we use this flag to |
129 // simply ignore all remaining drag events, and the eventual mouse release | 133 // simply ignore all remaining drag events, and the eventual mouse release |
130 // event. Since OnDragCanceled() can be called when we're not dragging, this | 134 // event. Since OnDragCanceled() can be called when we're not dragging, this |
131 // flag is reset to false on a mouse pressed event, to make sure we don't | 135 // flag is reset to false on a mouse pressed event, to make sure we don't |
132 // erroneously ignore the next drag. | 136 // erroneously ignore the next drag. |
133 bool ignore_mouse_drag_; | 137 bool ignore_mouse_drag_; |
134 | 138 |
135 // Whether our popup is currently open / shown, or closed / hidden. | 139 // Whether our popup is currently open / shown, or closed / hidden. |
136 bool opened_; | 140 bool opened_; |
137 | 141 |
138 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); | 142 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); |
139 }; | 143 }; |
140 | 144 |
141 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 145 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
OLD | NEW |