Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_popup_view_gtk.h

Issue 2973006: Use the extension icon for extension omnibox results instead of the generic (Closed)
Patch Set: fixed mac Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 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_POPUP_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_ 6 #define CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #include <map>
9 10
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
12 #include "chrome/browser/autocomplete/autocomplete_popup_view.h" 13 #include "chrome/browser/autocomplete/autocomplete_popup_view.h"
13 #include "chrome/common/notification_observer.h" 14 #include "chrome/common/notification_observer.h"
14 #include "chrome/common/notification_registrar.h" 15 #include "chrome/common/notification_registrar.h"
15 #include "webkit/glue/window_open_disposition.h" 16 #include "webkit/glue/window_open_disposition.h"
16 17
17 class AutocompleteEditModel; 18 class AutocompleteEditModel;
18 class AutocompleteEditView; 19 class AutocompleteEditView;
20 class AutocompleteMatch;
19 class AutocompletePopupModel; 21 class AutocompletePopupModel;
20 class GtkThemeProvider; 22 class GtkThemeProvider;
21 class Profile; 23 class Profile;
22 class SkBitmap; 24 class SkBitmap;
23 25
24 class AutocompletePopupViewGtk : public AutocompletePopupView, 26 class AutocompletePopupViewGtk : public AutocompletePopupView,
25 public NotificationObserver { 27 public NotificationObserver {
26 public: 28 public:
27 AutocompletePopupViewGtk(AutocompleteEditView* edit_view, 29 AutocompletePopupViewGtk(AutocompleteEditView* edit_view,
28 AutocompleteEditModel* edit_model, 30 AutocompleteEditModel* edit_model,
(...skipping 20 matching lines...) Expand all
49 51
50 // Restack the popup window directly above the browser's toplevel window. 52 // Restack the popup window directly above the browser's toplevel window.
51 void StackWindow(); 53 void StackWindow();
52 54
53 // Convert a y-coordinate to the closest line / result. 55 // Convert a y-coordinate to the closest line / result.
54 size_t LineFromY(int y); 56 size_t LineFromY(int y);
55 57
56 // Accept a line of the results, for example, when the user clicks a line. 58 // Accept a line of the results, for example, when the user clicks a line.
57 void AcceptLine(size_t line, WindowOpenDisposition disposition); 59 void AcceptLine(size_t line, WindowOpenDisposition disposition);
58 60
61 GdkPixbuf* IconForMatch(const AutocompleteMatch& match, bool selected);
62
59 static gboolean HandleExposeThunk(GtkWidget* widget, GdkEventExpose* event, 63 static gboolean HandleExposeThunk(GtkWidget* widget, GdkEventExpose* event,
60 gpointer userdata) { 64 gpointer userdata) {
61 return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)-> 65 return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)->
62 HandleExpose(widget, event); 66 HandleExpose(widget, event);
63 } 67 }
64 gboolean HandleExpose(GtkWidget* widget, GdkEventExpose* event); 68 gboolean HandleExpose(GtkWidget* widget, GdkEventExpose* event);
65 69
66 static gboolean HandleMotionThunk(GtkWidget* widget, GdkEventMotion* event, 70 static gboolean HandleMotionThunk(GtkWidget* widget, GdkEventMotion* event,
67 gpointer userdata) { 71 gpointer userdata) {
68 return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)-> 72 return reinterpret_cast<AutocompletePopupViewGtk*>(userdata)->
(...skipping 23 matching lines...) Expand all
92 96
93 // Our popup window, which is the only widget used, and we paint it on our 97 // Our popup window, which is the only widget used, and we paint it on our
94 // own. This widget shouldn't be exposed outside of this class. 98 // own. This widget shouldn't be exposed outside of this class.
95 GtkWidget* window_; 99 GtkWidget* window_;
96 // The pango layout object created from the window, cached across exposes. 100 // The pango layout object created from the window, cached across exposes.
97 PangoLayout* layout_; 101 PangoLayout* layout_;
98 102
99 GtkThemeProvider* theme_provider_; 103 GtkThemeProvider* theme_provider_;
100 NotificationRegistrar registrar_; 104 NotificationRegistrar registrar_;
101 105
106 // Used to cache GdkPixbufs and map them from the SkBitmaps they were created
107 // from.
108 typedef std::map<const SkBitmap*, GdkPixbuf*> PixbufMap;
109 PixbufMap pixbufs_;
110
102 // A list of colors which we should use for drawing the popup. These change 111 // A list of colors which we should use for drawing the popup. These change
103 // between gtk and normal mode. 112 // between gtk and normal mode.
104 GdkColor border_color_; 113 GdkColor border_color_;
105 GdkColor background_color_; 114 GdkColor background_color_;
106 GdkColor selected_background_color_; 115 GdkColor selected_background_color_;
107 GdkColor hovered_background_color_; 116 GdkColor hovered_background_color_;
108 GdkColor content_text_color_; 117 GdkColor content_text_color_;
109 GdkColor selected_content_text_color_; 118 GdkColor selected_content_text_color_;
110 GdkColor url_text_color_; 119 GdkColor url_text_color_;
111 GdkColor url_selected_text_color_; 120 GdkColor url_selected_text_color_;
112 GdkColor description_text_color_; 121 GdkColor description_text_color_;
113 GdkColor description_selected_text_color_; 122 GdkColor description_selected_text_color_;
114 123
115 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have 124 // If the user cancels a dragging action (i.e. by pressing ESC), we don't have
116 // a convenient way to release mouse capture. Instead we use this flag to 125 // a convenient way to release mouse capture. Instead we use this flag to
117 // simply ignore all remaining drag events, and the eventual mouse release 126 // simply ignore all remaining drag events, and the eventual mouse release
118 // event. Since OnDragCanceled() can be called when we're not dragging, this 127 // event. Since OnDragCanceled() can be called when we're not dragging, this
119 // flag is reset to false on a mouse pressed event, to make sure we don't 128 // flag is reset to false on a mouse pressed event, to make sure we don't
120 // erroneously ignore the next drag. 129 // erroneously ignore the next drag.
121 bool ignore_mouse_drag_; 130 bool ignore_mouse_drag_;
122 131
123 // Whether our popup is currently open / shown, or closed / hidden. 132 // Whether our popup is currently open / shown, or closed / hidden.
124 bool opened_; 133 bool opened_;
125 134
126 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewGtk); 135 DISALLOW_COPY_AND_ASSIGN(AutocompletePopupViewGtk);
127 }; 136 };
128 137
129 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_ 138 #endif // CHROME_BROWSER_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_VIEW_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_popup_model.cc ('k') | chrome/browser/autocomplete/autocomplete_popup_view_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698