| 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_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 "ui/base/glib/glib_integers.h" | 12 #include "ui/base/glib/glib_integers.h" |
| 13 #include "ui/base/gtk/gtk_signal.h" | 13 #include "ui/base/gtk/gtk_signal.h" |
| 14 #include "ui/gfx/font.h" | 14 #include "ui/gfx/font.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 class Rect; | 17 class Rect; |
| 18 } | 18 } |
| 19 | 19 |
| 20 typedef struct _GdkEventButton GdkEventButton; |
| 20 typedef struct _GdkEventExpose GdkEventExpose; | 21 typedef struct _GdkEventExpose GdkEventExpose; |
| 22 typedef struct _GdkEventMotion GdkEventMotion; |
| 21 typedef struct _GdkColor GdkColor; | 23 typedef struct _GdkColor GdkColor; |
| 22 typedef struct _GtkWidget GtkWidget; | 24 typedef struct _GtkWidget GtkWidget; |
| 23 | 25 |
| 24 class AutofillPopupViewGtk : public AutofillPopupView { | 26 class AutofillPopupViewGtk : public AutofillPopupView { |
| 25 public: | 27 public: |
| 26 AutofillPopupViewGtk(content::WebContents* web_contents, GtkWidget* parent); | 28 AutofillPopupViewGtk(content::WebContents* web_contents, |
| 29 AutofillExternalDelegate* external_delegate, |
| 30 GtkWidget* parent); |
| 27 virtual ~AutofillPopupViewGtk(); | 31 virtual ~AutofillPopupViewGtk(); |
| 28 | 32 |
| 33 protected: |
| 29 // AutofillPopupView implementations. | 34 // AutofillPopupView implementations. |
| 30 virtual void Hide() OVERRIDE; | |
| 31 virtual void ShowInternal() OVERRIDE; | 35 virtual void ShowInternal() OVERRIDE; |
| 36 virtual void HideInternal() OVERRIDE; |
| 37 virtual void InvalidateRow(size_t row) OVERRIDE; |
| 32 | 38 |
| 33 private: | 39 private: |
| 40 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleButtonRelease, |
| 41 GdkEventButton*); |
| 34 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleExpose, | 42 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleExpose, |
| 35 GdkEventExpose*); | 43 GdkEventExpose*); |
| 44 CHROMEGTK_CALLBACK_1(AutofillPopupViewGtk, gboolean, HandleMotion, |
| 45 GdkEventMotion*); |
| 36 | 46 |
| 37 // Setup the pango layout to display the autofill results. | 47 // Setup the pango layout to display the autofill results. |
| 38 void SetupLayout(const gfx::Rect& window_rect, const GdkColor& text_color); | 48 void SetupLayout(const gfx::Rect& window_rect, const GdkColor& text_color); |
| 39 | 49 |
| 50 // Convert a y-coordinate to the closest line. |
| 51 int LineFromY(int y); |
| 52 |
| 40 GtkWidget* parent_; // Weak reference. | 53 GtkWidget* parent_; // Weak reference. |
| 41 GtkWidget* window_; // Strong reference. | 54 GtkWidget* window_; // Strong reference. |
| 42 PangoLayout* layout_; // Strong reference | 55 PangoLayout* layout_; // Strong reference |
| 43 gfx::Font font_; | 56 gfx::Font font_; |
| 44 | 57 |
| 45 // The height of each individual Autofill popup row. | 58 // The height of each individual Autofill popup row. |
| 46 int row_height_; | 59 int row_height_; |
| 60 |
| 61 // The size of the popup. |
| 62 gfx::Rect bounds_; |
| 47 }; | 63 }; |
| 48 | 64 |
| 49 #endif // CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_ | 65 #endif // CHROME_BROWSER_UI_GTK_AUTOFILL_AUTOFILL_POPUP_VIEW_GTK_H_ |
| OLD | NEW |