| 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 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/autofill/autofill_popup_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 | 8 |
| 9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 g_signal_connect(window_, "motion-notify-event", | 58 g_signal_connect(window_, "motion-notify-event", |
| 59 G_CALLBACK(HandleMotionThunk), this); | 59 G_CALLBACK(HandleMotionThunk), this); |
| 60 g_signal_connect(window_, "button-release-event", | 60 g_signal_connect(window_, "button-release-event", |
| 61 G_CALLBACK(HandleButtonReleaseThunk), this); | 61 G_CALLBACK(HandleButtonReleaseThunk), this); |
| 62 | 62 |
| 63 // Cache the layout so we don't have to create it for every expose. | 63 // Cache the layout so we don't have to create it for every expose. |
| 64 layout_ = gtk_widget_create_pango_layout(window_, NULL); | 64 layout_ = gtk_widget_create_pango_layout(window_, NULL); |
| 65 } | 65 } |
| 66 | 66 |
| 67 AutofillPopupViewGtk::~AutofillPopupViewGtk() { | 67 AutofillPopupViewGtk::~AutofillPopupViewGtk() { |
| 68 controller_->ViewDestroyed(); | |
| 69 g_object_unref(layout_); | 68 g_object_unref(layout_); |
| 70 gtk_widget_destroy(window_); | 69 gtk_widget_destroy(window_); |
| 71 } | 70 } |
| 72 | 71 |
| 73 void AutofillPopupViewGtk::Hide() { | 72 void AutofillPopupViewGtk::Hide() { |
| 73 AutofillPopupView::Hide(); |
| 74 |
| 74 delete this; | 75 delete this; |
| 75 } | 76 } |
| 76 | 77 |
| 77 void AutofillPopupViewGtk::Show() { | 78 void AutofillPopupViewGtk::Show() { |
| 78 UpdateBoundsAndRedrawPopup(); | 79 UpdateBoundsAndRedrawPopup(); |
| 79 | 80 |
| 80 gtk_widget_show(window_); | 81 gtk_widget_show(window_); |
| 81 | 82 |
| 82 GtkWidget* parent_window = | 83 GtkWidget* parent_window = |
| 83 gtk_widget_get_toplevel(controller_->container_view()); | 84 gtk_widget_get_toplevel(controller_->container_view()); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 99 controller_->popup_bounds().y()); | 100 controller_->popup_bounds().y()); |
| 100 | 101 |
| 101 GdkWindow* gdk_window = gtk_widget_get_window(window_); | 102 GdkWindow* gdk_window = gtk_widget_get_window(window_); |
| 102 GdkRectangle popup_rect = controller_->popup_bounds().ToGdkRectangle(); | 103 GdkRectangle popup_rect = controller_->popup_bounds().ToGdkRectangle(); |
| 103 if (gdk_window != NULL) | 104 if (gdk_window != NULL) |
| 104 gdk_window_invalidate_rect(gdk_window, &popup_rect, FALSE); | 105 gdk_window_invalidate_rect(gdk_window, &popup_rect, FALSE); |
| 105 } | 106 } |
| 106 | 107 |
| 107 gboolean AutofillPopupViewGtk::HandleConfigure(GtkWidget* widget, | 108 gboolean AutofillPopupViewGtk::HandleConfigure(GtkWidget* widget, |
| 108 GdkEventConfigure* event) { | 109 GdkEventConfigure* event) { |
| 109 Hide(); | 110 controller_->Hide(); |
| 110 return FALSE; | 111 return FALSE; |
| 111 } | 112 } |
| 112 | 113 |
| 113 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, | 114 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, |
| 114 GdkEventButton* event) { | 115 GdkEventButton* event) { |
| 115 // We only care about the left click. | 116 // We only care about the left click. |
| 116 if (event->button != 1) | 117 if (event->button != 1) |
| 117 return FALSE; | 118 return FALSE; |
| 118 | 119 |
| 119 controller_->MouseClicked(event->x, event->y); | 120 controller_->MouseClicked(event->x, event->y); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 cairo_save(cairo_context); | 285 cairo_save(cairo_context); |
| 285 cairo_move_to(cairo_context, x_align_left, subtext_content_y); | 286 cairo_move_to(cairo_context, x_align_left, subtext_content_y); |
| 286 pango_cairo_show_layout(cairo_context, layout_); | 287 pango_cairo_show_layout(cairo_context, layout_); |
| 287 cairo_restore(cairo_context); | 288 cairo_restore(cairo_context); |
| 288 } | 289 } |
| 289 | 290 |
| 290 AutofillPopupView* AutofillPopupView::Create( | 291 AutofillPopupView* AutofillPopupView::Create( |
| 291 AutofillPopupController* controller) { | 292 AutofillPopupController* controller) { |
| 292 return new AutofillPopupViewGtk(controller); | 293 return new AutofillPopupViewGtk(controller); |
| 293 } | 294 } |
| OLD | NEW |