| 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 #include <pango/pango.h> | 8 #include <pango/pango.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 12 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
| 13 #include "chrome/browser/ui/gtk/gtk_util.h" | 13 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 14 #include "components/autofill/core/browser/popup_item_ids.h" |
| 14 #include "grit/ui_resources.h" | 15 #include "grit/ui_resources.h" |
| 15 #include "third_party/WebKit/public/web/WebAutofillClient.h" | |
| 16 #include "ui/base/gtk/gtk_hig_constants.h" | 16 #include "ui/base/gtk/gtk_hig_constants.h" |
| 17 #include "ui/base/gtk/gtk_windowing.h" | 17 #include "ui/base/gtk/gtk_windowing.h" |
| 18 #include "ui/base/resource/resource_bundle.h" | 18 #include "ui/base/resource/resource_bundle.h" |
| 19 #include "ui/gfx/geometry/point.h" | 19 #include "ui/gfx/geometry/point.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 21 #include "ui/gfx/gtk_compat.h" | 21 #include "ui/gfx/gtk_compat.h" |
| 22 #include "ui/gfx/image/image.h" | 22 #include "ui/gfx/image/image.h" |
| 23 #include "ui/gfx/native_widget_types.h" | 23 #include "ui/gfx/native_widget_types.h" |
| 24 #include "ui/gfx/pango_util.h" | 24 #include "ui/gfx/pango_util.h" |
| 25 #include "ui/gfx/text_utils.h" | 25 #include "ui/gfx/text_utils.h" |
| 26 | 26 |
| 27 using blink::WebAutofillClient; | |
| 28 | |
| 29 namespace { | 27 namespace { |
| 30 | 28 |
| 31 const GdkColor kBorderColor = GDK_COLOR_RGB(0xc7, 0xca, 0xce); | 29 const GdkColor kBorderColor = GDK_COLOR_RGB(0xc7, 0xca, 0xce); |
| 32 const GdkColor kHoveredBackgroundColor = GDK_COLOR_RGB(0xcd, 0xcd, 0xcd); | 30 const GdkColor kHoveredBackgroundColor = GDK_COLOR_RGB(0xcd, 0xcd, 0xcd); |
| 33 const GdkColor kNameColor = GDK_COLOR_RGB(0x00, 0x00, 0x00); | 31 const GdkColor kNameColor = GDK_COLOR_RGB(0x00, 0x00, 0x00); |
| 34 const GdkColor kWarningColor = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f); | 32 const GdkColor kWarningColor = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f); |
| 35 const GdkColor kSubtextColor = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f); | 33 const GdkColor kSubtextColor = GDK_COLOR_RGB(0x7f, 0x7f, 0x7f); |
| 36 | 34 |
| 37 } // namespace | 35 } // namespace |
| 38 | 36 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 SetUpLayout(); | 135 SetUpLayout(); |
| 138 | 136 |
| 139 gfx::Rect damage_rect(event->area); | 137 gfx::Rect damage_rect(event->area); |
| 140 | 138 |
| 141 for (size_t i = 0; i < controller_->names().size(); ++i) { | 139 for (size_t i = 0; i < controller_->names().size(); ++i) { |
| 142 gfx::Rect line_rect = controller_->GetRowBounds(i); | 140 gfx::Rect line_rect = controller_->GetRowBounds(i); |
| 143 // Only repaint and layout damaged lines. | 141 // Only repaint and layout damaged lines. |
| 144 if (!line_rect.Intersects(damage_rect)) | 142 if (!line_rect.Intersects(damage_rect)) |
| 145 continue; | 143 continue; |
| 146 | 144 |
| 147 if (controller_->identifiers()[i] == WebAutofillClient::MenuItemIDSeparator) | 145 if (controller_->identifiers()[i] == POPUP_ITEM_ID_SEPARATOR) |
| 148 DrawSeparator(cr, line_rect); | 146 DrawSeparator(cr, line_rect); |
| 149 else | 147 else |
| 150 DrawAutofillEntry(cr, i, line_rect); | 148 DrawAutofillEntry(cr, i, line_rect); |
| 151 } | 149 } |
| 152 | 150 |
| 153 cairo_destroy(cr); | 151 cairo_destroy(cr); |
| 154 | 152 |
| 155 return TRUE; | 153 return TRUE; |
| 156 } | 154 } |
| 157 | 155 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 pango_cairo_show_layout(cairo_context, layout_); | 287 pango_cairo_show_layout(cairo_context, layout_); |
| 290 cairo_restore(cairo_context); | 288 cairo_restore(cairo_context); |
| 291 } | 289 } |
| 292 | 290 |
| 293 AutofillPopupView* AutofillPopupView::Create( | 291 AutofillPopupView* AutofillPopupView::Create( |
| 294 AutofillPopupController* controller) { | 292 AutofillPopupController* controller) { |
| 295 return new AutofillPopupViewGtk(controller); | 293 return new AutofillPopupViewGtk(controller); |
| 296 } | 294 } |
| 297 | 295 |
| 298 } // namespace autofill | 296 } // namespace autofill |
| OLD | NEW |