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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 controller_->Hide(); | 110 controller_->Hide(); |
111 return FALSE; | 111 return FALSE; |
112 } | 112 } |
113 | 113 |
114 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, | 114 gboolean AutofillPopupViewGtk::HandleButtonRelease(GtkWidget* widget, |
115 GdkEventButton* event) { | 115 GdkEventButton* event) { |
116 // We only care about the left click. | 116 // We only care about the left click. |
117 if (event->button != 1) | 117 if (event->button != 1) |
118 return FALSE; | 118 return FALSE; |
119 | 119 |
120 controller_->MouseClicked(event->x, event->y); | 120 controller_->LineAcceptedAtPoint(event->x, event->y); |
121 return TRUE; | 121 return TRUE; |
122 } | 122 } |
123 | 123 |
124 gboolean AutofillPopupViewGtk::HandleExpose(GtkWidget* widget, | 124 gboolean AutofillPopupViewGtk::HandleExpose(GtkWidget* widget, |
125 GdkEventExpose* event) { | 125 GdkEventExpose* event) { |
126 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); | 126 cairo_t* cr = gdk_cairo_create(GDK_DRAWABLE(gtk_widget_get_window(widget))); |
127 gdk_cairo_rectangle(cr, &event->area); | 127 gdk_cairo_rectangle(cr, &event->area); |
128 cairo_clip(cr); | 128 cairo_clip(cr); |
129 | 129 |
130 // This assert is kinda ugly, but it would be more currently unneeded work | 130 // This assert is kinda ugly, but it would be more currently unneeded work |
(...skipping 20 matching lines...) Expand all Loading... |
151 DrawAutofillEntry(cr, i, line_rect); | 151 DrawAutofillEntry(cr, i, line_rect); |
152 } | 152 } |
153 | 153 |
154 cairo_destroy(cr); | 154 cairo_destroy(cr); |
155 | 155 |
156 return TRUE; | 156 return TRUE; |
157 } | 157 } |
158 | 158 |
159 gboolean AutofillPopupViewGtk::HandleLeave(GtkWidget* widget, | 159 gboolean AutofillPopupViewGtk::HandleLeave(GtkWidget* widget, |
160 GdkEventCrossing* event) { | 160 GdkEventCrossing* event) { |
161 controller_->MouseExitedPopup(); | 161 controller_->SelectionCleared(); |
162 | 162 |
163 return FALSE; | 163 return FALSE; |
164 } | 164 } |
165 | 165 |
166 gboolean AutofillPopupViewGtk::HandleMotion(GtkWidget* widget, | 166 gboolean AutofillPopupViewGtk::HandleMotion(GtkWidget* widget, |
167 GdkEventMotion* event) { | 167 GdkEventMotion* event) { |
168 controller_->MouseHovered(event->x, event->y); | 168 controller_->LineSelectedAtPoint(event->x, event->y); |
169 | 169 |
170 return TRUE; | 170 return TRUE; |
171 } | 171 } |
172 | 172 |
173 void AutofillPopupViewGtk::SetUpLayout() { | 173 void AutofillPopupViewGtk::SetUpLayout() { |
174 pango_layout_set_width(layout_, window_->allocation.width * PANGO_SCALE); | 174 pango_layout_set_width(layout_, window_->allocation.width * PANGO_SCALE); |
175 pango_layout_set_height(layout_, window_->allocation.height * PANGO_SCALE); | 175 pango_layout_set_height(layout_, window_->allocation.height * PANGO_SCALE); |
176 } | 176 } |
177 | 177 |
178 void AutofillPopupViewGtk::SetLayoutText(const string16& text, | 178 void AutofillPopupViewGtk::SetLayoutText(const string16& text, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 pango_cairo_show_layout(cairo_context, layout_); | 285 pango_cairo_show_layout(cairo_context, layout_); |
286 cairo_restore(cairo_context); | 286 cairo_restore(cairo_context); |
287 } | 287 } |
288 | 288 |
289 AutofillPopupView* AutofillPopupView::Create( | 289 AutofillPopupView* AutofillPopupView::Create( |
290 AutofillPopupController* controller) { | 290 AutofillPopupController* controller) { |
291 return new AutofillPopupViewGtk(controller); | 291 return new AutofillPopupViewGtk(controller); |
292 } | 292 } |
293 | 293 |
294 } // namespace autofill | 294 } // namespace autofill |
OLD | NEW |