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