Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(467)

Unified Diff: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc

Issue 1570783003: [Autofill] Move functions from the AutofillPopupController to AutofillPopupLayoutModel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: controller now owns the helper Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
diff --git a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
index 2fa7ba5d84a0f4b331f0435a4bb0e8783ffe1383..af5dd177e2553de622b2c3745f4ae3e3eeb8b4cc 100644
--- a/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
+++ b/chrome/browser/ui/views/autofill/autofill_popup_view_views.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller.h"
+#include "chrome/browser/ui/autofill/autofill_popup_view_helper.h"
#include "components/autofill/core/browser/popup_item_ids.h"
#include "components/autofill/core/browser/suggestion.h"
#include "ui/base/resource/resource_bundle.h"
@@ -51,7 +52,7 @@ void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
OnPaintBorder(canvas);
for (size_t i = 0; i < controller_->GetLineCount(); ++i) {
- gfx::Rect line_rect = controller_->GetRowBounds(i);
+ gfx::Rect line_rect = controller_->view_helper()->GetRowBounds(i);
if (controller_->GetSuggestionAt(i).frontend_id ==
POPUP_ITEM_ID_SEPARATOR) {
@@ -63,7 +64,7 @@ void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) {
}
void AutofillPopupViewViews::InvalidateRow(size_t row) {
- SchedulePaintInRect(controller_->GetRowBounds(row));
+ SchedulePaintInRect(controller_->view_helper()->GetRowBounds(row));
}
void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
@@ -76,7 +77,7 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
const int text_align =
is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT;
gfx::Rect value_rect = entry_rect;
- value_rect.Inset(kEndPadding, 0);
+ value_rect.Inset(AutofillPopupViewHelper::kEndPadding, 0);
canvas->DrawStringRectWithFlags(
controller_->GetElidedValueAt(index),
controller_->GetValueFontListForRow(index),
@@ -84,13 +85,15 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
value_rect, text_align);
// Use this to figure out where all the other Autofill items should be placed.
- int x_align_left = is_rtl ? kEndPadding : entry_rect.right() - kEndPadding;
+ int x_align_left =
+ is_rtl ? AutofillPopupViewHelper::kEndPadding
+ : entry_rect.right() - AutofillPopupViewHelper::kEndPadding;
// Draw the Autofill icon, if one exists
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- int row_height = controller_->GetRowBounds(index).height();
+ int row_height = controller_->view_helper()->GetRowBounds(index).height();
if (!controller_->GetSuggestionAt(index).icon.empty()) {
- int icon = controller_->GetIconResourceID(
+ int icon = controller_->view_helper()->GetIconResourceID(
controller_->GetSuggestionAt(index).icon);
DCHECK_NE(-1, icon);
const gfx::ImageSkia* image = rb.GetImageSkiaNamed(icon);
@@ -100,7 +103,9 @@ void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas,
canvas->DrawImageInt(*image, x_align_left, icon_y);
- x_align_left += is_rtl ? image->width() + kIconPadding : -kIconPadding;
+ x_align_left += is_rtl
+ ? image->width() + AutofillPopupViewHelper::kIconPadding
+ : -AutofillPopupViewHelper::kIconPadding;
}
// Draw the label text.

Powered by Google App Engine
This is Rietveld 408576698