| 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 "autofill_popup_view_gtk.h" | 5 #include "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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 delete_icon = theme_service_->GetImageNamed(IDR_CLOSE_BAR_H); | 343 delete_icon = theme_service_->GetImageNamed(IDR_CLOSE_BAR_H); |
| 344 else | 344 else |
| 345 delete_icon = theme_service_->GetImageNamed(IDR_CLOSE_BAR); | 345 delete_icon = theme_service_->GetImageNamed(IDR_CLOSE_BAR); |
| 346 | 346 |
| 347 // TODO(csharp): Create a custom resource for the delete icon. | 347 // TODO(csharp): Create a custom resource for the delete icon. |
| 348 // http://www.crbug.com/131801 | 348 // http://www.crbug.com/131801 |
| 349 cairo_save(cairo_context); | 349 cairo_save(cairo_context); |
| 350 gtk_util::DrawFullImage( | 350 gtk_util::DrawFullImage( |
| 351 cairo_context, | 351 cairo_context, |
| 352 window_, | 352 window_, |
| 353 delete_icon, | 353 *delete_icon, |
| 354 x_align_left, | 354 x_align_left, |
| 355 entry_rect.y() + ((kRowHeight - kDeleteIconHeight) / 2)); | 355 entry_rect.y() + ((kRowHeight - kDeleteIconHeight) / 2)); |
| 356 cairo_restore(cairo_context); | 356 cairo_restore(cairo_context); |
| 357 cairo_save(cairo_context); | 357 cairo_save(cairo_context); |
| 358 | 358 |
| 359 x_align_left += is_rtl ? kDeleteIconWidth + kIconPadding : -kIconPadding; | 359 x_align_left += is_rtl ? kDeleteIconWidth + kIconPadding : -kIconPadding; |
| 360 } | 360 } |
| 361 | 361 |
| 362 // Draw the Autofill icon, if one exists | 362 // Draw the Autofill icon, if one exists |
| 363 if (!autofill_icons()[index].empty()) { | 363 if (!autofill_icons()[index].empty()) { |
| 364 int icon = GetIconResourceID(autofill_icons()[index]); | 364 int icon = GetIconResourceID(autofill_icons()[index]); |
| 365 DCHECK_NE(-1, icon); | 365 DCHECK_NE(-1, icon); |
| 366 int icon_y = entry_rect.y() + ((kRowHeight - kAutofillIconHeight) / 2); | 366 int icon_y = entry_rect.y() + ((kRowHeight - kAutofillIconHeight) / 2); |
| 367 | 367 |
| 368 x_align_left += is_rtl ? 0 : -kAutofillIconWidth; | 368 x_align_left += is_rtl ? 0 : -kAutofillIconWidth; |
| 369 | 369 |
| 370 cairo_save(cairo_context); | 370 cairo_save(cairo_context); |
| 371 gtk_util::DrawFullImage(cairo_context, | 371 gtk_util::DrawFullImage(cairo_context, |
| 372 window_, | 372 window_, |
| 373 theme_service_->GetImageNamed(icon), | 373 *theme_service_->GetImageNamed(icon), |
| 374 x_align_left, | 374 x_align_left, |
| 375 icon_y); | 375 icon_y); |
| 376 cairo_restore(cairo_context); | 376 cairo_restore(cairo_context); |
| 377 | 377 |
| 378 x_align_left += is_rtl ? kAutofillIconWidth + kIconPadding : -kIconPadding; | 378 x_align_left += is_rtl ? kAutofillIconWidth + kIconPadding : -kIconPadding; |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Draw the label text. | 381 // Draw the label text. |
| 382 SetLayoutText(autofill_labels()[index], label_font_, kLabelTextColor); | 382 SetLayoutText(autofill_labels()[index], label_font_, kLabelTextColor); |
| 383 x_align_left += | 383 x_align_left += |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 492 } | 492 } |
| 493 | 493 |
| 494 gfx::Rect delete_icon_bounds = gfx::Rect( | 494 gfx::Rect delete_icon_bounds = gfx::Rect( |
| 495 GetPopupRequiredWidth() - kDeleteIconWidth - kIconPadding, | 495 GetPopupRequiredWidth() - kDeleteIconWidth - kIconPadding, |
| 496 row_start_y + ((kRowHeight - kDeleteIconHeight) / 2), | 496 row_start_y + ((kRowHeight - kDeleteIconHeight) / 2), |
| 497 kDeleteIconWidth, | 497 kDeleteIconWidth, |
| 498 kDeleteIconHeight); | 498 kDeleteIconHeight); |
| 499 | 499 |
| 500 return delete_icon_bounds.Contains(x, y); | 500 return delete_icon_bounds.Contains(x, y); |
| 501 } | 501 } |
| OLD | NEW |