| 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() { |
| 74 delete this; | 73 delete this; |
| 75 } | 74 } |
| 76 | 75 |
| 77 void AutofillPopupViewGtk::Show() { | 76 void AutofillPopupViewGtk::Show() { |
| 78 UpdateBoundsAndRedrawPopup(); | 77 UpdateBoundsAndRedrawPopup(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 99 controller_->popup_bounds().y()); | 98 controller_->popup_bounds().y()); |
| 100 | 99 |
| 101 GdkWindow* gdk_window = gtk_widget_get_window(window_); | 100 GdkWindow* gdk_window = gtk_widget_get_window(window_); |
| 102 GdkRectangle popup_rect = controller_->popup_bounds().ToGdkRectangle(); | 101 GdkRectangle popup_rect = controller_->popup_bounds().ToGdkRectangle(); |
| 103 if (gdk_window != NULL) | 102 if (gdk_window != NULL) |
| 104 gdk_window_invalidate_rect(gdk_window, &popup_rect, FALSE); | 103 gdk_window_invalidate_rect(gdk_window, &popup_rect, FALSE); |
| 105 } | 104 } |
| 106 | 105 |
| 107 gboolean AutofillPopupViewGtk::HandleConfigure(GtkWidget* widget, | 106 gboolean AutofillPopupViewGtk::HandleConfigure(GtkWidget* widget, |
| 108 GdkEventConfigure* event) { | 107 GdkEventConfigure* event) { |
| 109 Hide(); | 108 controller_->Hide(); |
| 110 return FALSE; | 109 return FALSE; |
| 111 } | 110 } |
| 112 | 111 |
| 113 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, | 112 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, |
| 114 GdkEventButton* event) { | 113 GdkEventButton* event) { |
| 115 // We only care about the left click. | 114 // We only care about the left click. |
| 116 if (event->button != 1) | 115 if (event->button != 1) |
| 117 return FALSE; | 116 return FALSE; |
| 118 | 117 |
| 119 controller_->MouseClicked(event->x, event->y); | 118 controller_->MouseClicked(event->x, event->y); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 cairo_save(cairo_context); | 312 cairo_save(cairo_context); |
| 314 cairo_move_to(cairo_context, x_align_left, subtext_content_y); | 313 cairo_move_to(cairo_context, x_align_left, subtext_content_y); |
| 315 pango_cairo_show_layout(cairo_context, layout_); | 314 pango_cairo_show_layout(cairo_context, layout_); |
| 316 cairo_restore(cairo_context); | 315 cairo_restore(cairo_context); |
| 317 } | 316 } |
| 318 | 317 |
| 319 AutofillPopupView* AutofillPopupView::Create( | 318 AutofillPopupView* AutofillPopupView::Create( |
| 320 AutofillPopupController* controller) { | 319 AutofillPopupController* controller) { |
| 321 return new AutofillPopupViewGtk(controller); | 320 return new AutofillPopupViewGtk(controller); |
| 322 } | 321 } |
| OLD | NEW |