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 "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
10 #include "ui/base/keycodes/keyboard_codes.h" | 10 #include "ui/base/keycodes/keyboard_codes.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 observing_widget_->RemoveObserver(this); | 168 observing_widget_->RemoveObserver(this); |
169 } | 169 } |
170 | 170 |
171 void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, | 171 void AutofillPopupViewViews::DrawAutofillEntry(gfx::Canvas* canvas, |
172 int index, | 172 int index, |
173 const gfx::Rect& entry_rect) { | 173 const gfx::Rect& entry_rect) { |
174 if (controller_->selected_line() == index) | 174 if (controller_->selected_line() == index) |
175 canvas->FillRect(entry_rect, kHoveredBackgroundColor); | 175 canvas->FillRect(entry_rect, kHoveredBackgroundColor); |
176 | 176 |
177 bool is_rtl = base::i18n::IsRTL(); | 177 bool is_rtl = controller_->IsRTL(); |
178 int value_text_width = controller_->GetNameFontForRow(index).GetStringWidth( | 178 int value_text_width = controller_->GetNameFontForRow(index).GetStringWidth( |
179 controller_->names()[index]); | 179 controller_->names()[index]); |
180 int value_content_x = is_rtl ? | 180 int value_content_x = is_rtl ? |
181 entry_rect.width() - value_text_width - kEndPadding : kEndPadding; | 181 entry_rect.width() - value_text_width - kEndPadding : kEndPadding; |
182 | 182 |
183 canvas->DrawStringInt( | 183 canvas->DrawStringInt( |
184 controller_->names()[index], | 184 controller_->names()[index], |
185 controller_->GetNameFontForRow(index), | 185 controller_->GetNameFontForRow(index), |
186 kValueTextColor, | 186 kValueTextColor, |
187 value_content_x, | 187 value_content_x, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // If the top level widget can't be found, cancel the popup since we can't | 236 // If the top level widget can't be found, cancel the popup since we can't |
237 // fully set it up. | 237 // fully set it up. |
238 if (!observing_widget) | 238 if (!observing_widget) |
239 return NULL; | 239 return NULL; |
240 | 240 |
241 return new AutofillPopupViewViews(controller, observing_widget); | 241 return new AutofillPopupViewViews(controller, observing_widget); |
242 } | 242 } |
243 | 243 |
244 } // namespace autofill | 244 } // namespace autofill |
OLD | NEW |