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/views/autofill/autofill_popup_view_views.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_popup_view_views.h" |
6 | 6 |
7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" | 7 #include "chrome/browser/ui/autofill/autofill_popup_controller.h" |
8 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" | 8 #include "chrome/browser/ui/autofill/autofill_popup_layout_model.h" |
9 #include "chrome/browser/ui/autofill/popup_constants.h" | 9 #include "chrome/browser/ui/autofill/popup_constants.h" |
10 #include "components/autofill/core/browser/popup_item_ids.h" | 10 #include "components/autofill/core/browser/popup_item_ids.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 canvas->FillRect(entry_rect, controller_->GetBackgroundColorForRow(index)); | 74 canvas->FillRect(entry_rect, controller_->GetBackgroundColorForRow(index)); |
75 | 75 |
76 const bool is_rtl = controller_->IsRTL(); | 76 const bool is_rtl = controller_->IsRTL(); |
77 const int text_align = | 77 const int text_align = |
78 is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT; | 78 is_rtl ? gfx::Canvas::TEXT_ALIGN_RIGHT : gfx::Canvas::TEXT_ALIGN_LEFT; |
79 gfx::Rect value_rect = entry_rect; | 79 gfx::Rect value_rect = entry_rect; |
80 value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0); | 80 value_rect.Inset(AutofillPopupLayoutModel::kEndPadding, 0); |
81 canvas->DrawStringRectWithFlags( | 81 canvas->DrawStringRectWithFlags( |
82 controller_->GetElidedValueAt(index), | 82 controller_->GetElidedValueAt(index), |
83 controller_->layout_model().GetValueFontListForRow(index), | 83 controller_->layout_model().GetValueFontListForRow(index), |
84 controller_->IsWarning(index) ? kLabelTextColor : kValueTextColor, | 84 controller_->layout_model().GetValueFontColorForRow(index), value_rect, |
lshang
2016/11/15 07:25:19
Didn't remove IsWarning() because it is also used
Mathieu
2016/11/16 05:09:46
Can you make a change (now or later) to use GetVal
lshang
2016/11/16 09:34:23
A TODO is added. I'll address this in a separate C
| |
85 value_rect, text_align); | 85 text_align); |
86 | 86 |
87 // Use this to figure out where all the other Autofill items should be placed. | 87 // Use this to figure out where all the other Autofill items should be placed. |
88 int x_align_left = | 88 int x_align_left = |
89 is_rtl ? AutofillPopupLayoutModel::kEndPadding | 89 is_rtl ? AutofillPopupLayoutModel::kEndPadding |
90 : entry_rect.right() - AutofillPopupLayoutModel::kEndPadding; | 90 : entry_rect.right() - AutofillPopupLayoutModel::kEndPadding; |
91 | 91 |
92 // Draw the Autofill icon, if one exists | 92 // Draw the Autofill icon, if one exists |
93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 93 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
94 int row_height = controller_->layout_model().GetRowBounds(index).height(); | 94 int row_height = controller_->layout_model().GetRowBounds(index).height(); |
95 if (!controller_->GetSuggestionAt(index).icon.empty()) { | 95 if (!controller_->GetSuggestionAt(index).icon.empty()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
130 | 130 |
131 // If the top level widget can't be found, cancel the popup since we can't | 131 // If the top level widget can't be found, cancel the popup since we can't |
132 // fully set it up. | 132 // fully set it up. |
133 if (!observing_widget) | 133 if (!observing_widget) |
134 return NULL; | 134 return NULL; |
135 | 135 |
136 return new AutofillPopupViewViews(controller, observing_widget); | 136 return new AutofillPopupViewViews(controller, observing_widget); |
137 } | 137 } |
138 | 138 |
139 } // namespace autofill | 139 } // namespace autofill |
OLD | NEW |