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

Side by Side Diff: chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h

Issue 9432029: GTK Keyboard Support for New Autofill (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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) 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_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_ 5 #ifndef CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_
6 #define CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_ 6 #define CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_
7 #pragma once 7 #pragma once
8 8
9 #include <pango/pango.h> 9 #include <pango/pango.h>
10 10
11 #include "chrome/browser/autofill/autofill_popup_view.h" 11 #include "chrome/browser/autofill/autofill_popup_view.h"
12 #include "content/public/browser/keyboard_listener.h"
12 #include "ui/base/glib/glib_integers.h" 13 #include "ui/base/glib/glib_integers.h"
13 #include "ui/base/gtk/gtk_signal.h" 14 #include "ui/base/gtk/gtk_signal.h"
14 #include "ui/gfx/font.h" 15 #include "ui/gfx/font.h"
15 16
17 namespace content {
18 class RenderViewHost;
19 }
20
16 namespace gfx { 21 namespace gfx {
17 class Rect; 22 class Rect;
18 } 23 }
19 24
20 typedef struct _GdkEventButton GdkEventButton; 25 typedef struct _GdkEventButton GdkEventButton;
21 typedef struct _GdkEventExpose GdkEventExpose; 26 typedef struct _GdkEventExpose GdkEventExpose;
27 typedef struct _GdkEventKey GdkEventKey;
22 typedef struct _GdkEventMotion GdkEventMotion; 28 typedef struct _GdkEventMotion GdkEventMotion;
23 typedef struct _GdkColor GdkColor; 29 typedef struct _GdkColor GdkColor;
24 typedef struct _GtkWidget GtkWidget; 30 typedef struct _GtkWidget GtkWidget;
25 31
26 class AutofillPopupViewGtk : public AutofillPopupView { 32 class AutofillPopupViewGtk : public AutofillPopupView,
33 public KeyboardListener {
27 public: 34 public:
28 AutofillPopupViewGtk(content::WebContents* web_contents, 35 AutofillPopupViewGtk(content::WebContents* web_contents,
29 AutofillExternalDelegate* external_delegate, 36 AutofillExternalDelegate* external_delegate,
30 GtkWidget* parent); 37 GtkWidget* parent);
31 virtual ~AutofillPopupViewGtk(); 38 virtual ~AutofillPopupViewGtk();
32 39
33 protected: 40 protected:
34 // AutofillPopupView implementations. 41 // AutofillPopupView implementations.
35 virtual void ShowInternal() OVERRIDE; 42 virtual void ShowInternal() OVERRIDE;
36 virtual void HideInternal() OVERRIDE; 43 virtual void HideInternal() OVERRIDE;
37 virtual void InvalidateRow(size_t row) OVERRIDE; 44 virtual void InvalidateRow(size_t row) OVERRIDE;
38 45
39 private: 46 private:
40 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleButtonRelease, 47 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleButtonRelease,
41 GdkEventButton*); 48 GdkEventButton*);
42 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleExpose, 49 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleExpose,
43 GdkEventExpose*); 50 GdkEventExpose*);
44 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleMotion, 51 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleMotion,
45 GdkEventMotion*); 52 GdkEventMotion*);
46 53
54 // KeyboardListener implementations.
Ilya Sherman 2012/03/21 23:35:30 nit: "implementations" -> "implementation"
csharp 2012/03/23 15:10:52 Done.
55 virtual bool HandleKeyPressEvent(GdkEventKey* event) OVERRIDE;
56
47 // Setup the pango layout to display the autofill results. 57 // Setup the pango layout to display the autofill results.
48 void SetupLayout(const gfx::Rect& window_rect, const GdkColor& text_color); 58 void SetupLayout(const gfx::Rect& window_rect, const GdkColor& text_color);
49 59
60 // Get width of popup needs by values.
61 int GetPopupRequiredWidth();
62
50 // Convert a y-coordinate to the closest line. 63 // Convert a y-coordinate to the closest line.
51 int LineFromY(int y); 64 int LineFromY(int y);
52 65
53 GtkWidget* parent_; // Weak reference. 66 GtkWidget* parent_; // Weak reference.
54 GtkWidget* window_; // Strong reference. 67 GtkWidget* window_; // Strong reference.
55 PangoLayout* layout_; // Strong reference 68 PangoLayout* layout_; // Strong reference
56 gfx::Font font_; 69 gfx::Font font_;
57 70
58 // The height of each individual Autofill popup row. 71 // The height of each individual Autofill popup row.
59 int row_height_; 72 int row_height_;
60 73
61 // The size of the popup. 74 // The size of the popup.
62 gfx::Rect bounds_; 75 gfx::Rect bounds_;
76
77 content::RenderViewHost* render_view_host_; // Weak reference.
63 }; 78 };
64 79
65 #endif // CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_ 80 #endif // CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698