Chromium Code Reviews| 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 "components/autofill/core/common/autofill_enums.h" | |
| 8 #include "grit/ui_resources.h" | 9 #include "grit/ui_resources.h" |
| 9 #include "third_party/WebKit/public/web/WebAutofillClient.h" | |
| 10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
| 11 #include "ui/events/keycodes/keyboard_codes.h" | 11 #include "ui/events/keycodes/keyboard_codes.h" |
| 12 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 13 #include "ui/gfx/image/image.h" | 13 #include "ui/gfx/image/image.h" |
| 14 #include "ui/gfx/native_widget_types.h" | 14 #include "ui/gfx/native_widget_types.h" |
| 15 #include "ui/gfx/point.h" | 15 #include "ui/gfx/point.h" |
| 16 #include "ui/gfx/rect.h" | 16 #include "ui/gfx/rect.h" |
| 17 #include "ui/gfx/text_utils.h" | 17 #include "ui/gfx/text_utils.h" |
| 18 #include "ui/views/border.h" | 18 #include "ui/views/border.h" |
| 19 #include "ui/views/widget/widget.h" | 19 #include "ui/views/widget/widget.h" |
| 20 | 20 |
| 21 using blink::WebAutofillClient; | |
| 22 | |
| 23 namespace autofill { | 21 namespace autofill { |
| 24 | 22 |
| 25 AutofillPopupViewViews::AutofillPopupViewViews( | 23 AutofillPopupViewViews::AutofillPopupViewViews( |
| 26 AutofillPopupController* controller, views::Widget* observing_widget) | 24 AutofillPopupController* controller, views::Widget* observing_widget) |
| 27 : AutofillPopupBaseView(controller, observing_widget), | 25 : AutofillPopupBaseView(controller, observing_widget), |
| 28 controller_(controller) {} | 26 controller_(controller) {} |
| 29 | 27 |
| 30 AutofillPopupViewViews::~AutofillPopupViewViews() {} | 28 AutofillPopupViewViews::~AutofillPopupViewViews() {} |
| 31 | 29 |
| 32 void AutofillPopupViewViews::Show() { | 30 void AutofillPopupViewViews::Show() { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 47 void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) { | 45 void AutofillPopupViewViews::OnPaint(gfx::Canvas* canvas) { |
| 48 if (!controller_) | 46 if (!controller_) |
| 49 return; | 47 return; |
| 50 | 48 |
| 51 canvas->DrawColor(kPopupBackground); | 49 canvas->DrawColor(kPopupBackground); |
| 52 OnPaintBorder(canvas); | 50 OnPaintBorder(canvas); |
| 53 | 51 |
| 54 for (size_t i = 0; i < controller_->names().size(); ++i) { | 52 for (size_t i = 0; i < controller_->names().size(); ++i) { |
| 55 gfx::Rect line_rect = controller_->GetRowBounds(i); | 53 gfx::Rect line_rect = controller_->GetRowBounds(i); |
| 56 | 54 |
| 57 if (controller_->identifiers()[i] == | 55 if (controller_->identifiers()[i] == MenuItemIDSeparator) { |
|
Evan Stade
2014/02/11 18:56:39
remove a space after ==
gnana
2014/02/12 13:34:09
Done.
| |
| 58 WebAutofillClient::MenuItemIDSeparator) { | |
| 59 canvas->DrawRect(line_rect, kItemTextColor); | 56 canvas->DrawRect(line_rect, kItemTextColor); |
| 60 } else { | 57 } else { |
| 61 DrawAutofillEntry(canvas, i, line_rect); | 58 DrawAutofillEntry(canvas, i, line_rect); |
| 62 } | 59 } |
| 63 } | 60 } |
| 64 } | 61 } |
| 65 | 62 |
| 66 void AutofillPopupViewViews::InvalidateRow(size_t row) { | 63 void AutofillPopupViewViews::InvalidateRow(size_t row) { |
| 67 SchedulePaintInRect(controller_->GetRowBounds(row)); | 64 SchedulePaintInRect(controller_->GetRowBounds(row)); |
| 68 } | 65 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 | 132 |
| 136 // If the top level widget can't be found, cancel the popup since we can't | 133 // If the top level widget can't be found, cancel the popup since we can't |
| 137 // fully set it up. | 134 // fully set it up. |
| 138 if (!observing_widget) | 135 if (!observing_widget) |
| 139 return NULL; | 136 return NULL; |
| 140 | 137 |
| 141 return new AutofillPopupViewViews(controller, observing_widget); | 138 return new AutofillPopupViewViews(controller, observing_widget); |
| 142 } | 139 } |
| 143 | 140 |
| 144 } // namespace autofill | 141 } // namespace autofill |
| OLD | NEW |