OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 // Restack the popup window directly above the browser's toplevel window. | 76 // Restack the popup window directly above the browser's toplevel window. |
77 void StackWindow(); | 77 void StackWindow(); |
78 | 78 |
79 // Convert a y-coordinate to the closest line / result. | 79 // Convert a y-coordinate to the closest line / result. |
80 size_t LineFromY(int y); | 80 size_t LineFromY(int y); |
81 | 81 |
82 // Accept a line of the results, for example, when the user clicks a line. | 82 // Accept a line of the results, for example, when the user clicks a line. |
83 void AcceptLine(size_t line, WindowOpenDisposition disposition); | 83 void AcceptLine(size_t line, WindowOpenDisposition disposition); |
84 | 84 |
85 const gfx::Image* IconForMatch(const AutocompleteMatch& match, | 85 gfx::Image IconForMatch(const AutocompleteMatch& match, |
86 bool selected, | 86 bool selected, |
87 bool is_selected_keyword); | 87 bool is_selected_keyword); |
88 | 88 |
89 // Returns the |index|th element of match, unless we're selected and showing | 89 // Returns the |index|th element of match, unless we're selected and showing |
90 // the associated keyword match. | 90 // the associated keyword match. |
91 void GetVisibleMatchForInput(size_t index, | 91 void GetVisibleMatchForInput(size_t index, |
92 const AutocompleteMatch** match, | 92 const AutocompleteMatch** match, |
93 bool* is_selected_keyword); | 93 bool* is_selected_keyword); |
94 | 94 |
95 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleMotion, | 95 CHROMEGTK_CALLBACK_1(OmniboxPopupViewGtk, gboolean, HandleMotion, |
96 GdkEventMotion*); | 96 GdkEventMotion*); |
97 | 97 |
(...skipping 17 matching lines...) Expand all Loading... |
115 // The pango layout object created from the window, cached across exposes. | 115 // The pango layout object created from the window, cached across exposes. |
116 PangoLayout* layout_; | 116 PangoLayout* layout_; |
117 | 117 |
118 GtkThemeService* theme_service_; | 118 GtkThemeService* theme_service_; |
119 content::NotificationRegistrar registrar_; | 119 content::NotificationRegistrar registrar_; |
120 | 120 |
121 // Font used for suggestions after being derived from the constructor's | 121 // Font used for suggestions after being derived from the constructor's |
122 // |font|. | 122 // |font|. |
123 gfx::Font font_; | 123 gfx::Font font_; |
124 | 124 |
125 // Used to cache GdkPixbufs and map them from the SkBitmaps they were created | |
126 // from. | |
127 typedef std::map<const SkBitmap*, gfx::Image*> ImageMap; | |
128 ImageMap images_; | |
129 | |
130 // A list of colors which we should use for drawing the popup. These change | 125 // A list of colors which we should use for drawing the popup. These change |
131 // between gtk and normal mode. | 126 // between gtk and normal mode. |
132 GdkColor border_color_; | 127 GdkColor border_color_; |
133 GdkColor background_color_; | 128 GdkColor background_color_; |
134 GdkColor selected_background_color_; | 129 GdkColor selected_background_color_; |
135 GdkColor hovered_background_color_; | 130 GdkColor hovered_background_color_; |
136 GdkColor content_text_color_; | 131 GdkColor content_text_color_; |
137 GdkColor selected_content_text_color_; | 132 GdkColor selected_content_text_color_; |
138 GdkColor content_dim_text_color_; | 133 GdkColor content_dim_text_color_; |
139 GdkColor selected_content_dim_text_color_; | 134 GdkColor selected_content_dim_text_color_; |
140 GdkColor url_text_color_; | 135 GdkColor url_text_color_; |
141 GdkColor url_selected_text_color_; | 136 GdkColor url_selected_text_color_; |
142 | 137 |
143 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have | 138 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have |
144 // a convenient way to release mouse capture. Instead we use this flag to | 139 // a convenient way to release mouse capture. Instead we use this flag to |
145 // simply ignore all remaining drag events, and the eventual mouse release | 140 // simply ignore all remaining drag events, and the eventual mouse release |
146 // event. Since OnDragCanceled() can be called when we're not dragging, this | 141 // event. Since OnDragCanceled() can be called when we're not dragging, this |
147 // flag is reset to false on a mouse pressed event, to make sure we don't | 142 // flag is reset to false on a mouse pressed event, to make sure we don't |
148 // erroneously ignore the next drag. | 143 // erroneously ignore the next drag. |
149 bool ignore_mouse_drag_; | 144 bool ignore_mouse_drag_; |
150 | 145 |
151 // Whether our popup is currently open / shown, or closed / hidden. | 146 // Whether our popup is currently open / shown, or closed / hidden. |
152 bool opened_; | 147 bool opened_; |
153 | 148 |
154 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); | 149 DISALLOW_COPY_AND_ASSIGN(OmniboxPopupViewGtk); |
155 }; | 150 }; |
156 | 151 |
157 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ | 152 #endif // CHROME_BROWSER_UI_GTK_OMNIBOX_OMNIBOX_POPUP_VIEW_GTK_H_ |
OLD | NEW |