| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void AutofillPopupViewViews::OnMouseReleased(const ui::MouseEvent& event) { | 99 void AutofillPopupViewViews::OnMouseReleased(const ui::MouseEvent& event) { |
| 100 // We only care about the left click. | 100 // We only care about the left click. |
| 101 if (event.IsOnlyLeftMouseButton() && | 101 if (event.IsOnlyLeftMouseButton() && |
| 102 HitTestPoint(gfx::Point(event.x(), event.y()))) | 102 HitTestPoint(gfx::Point(event.x(), event.y()))) |
| 103 controller_->MouseClicked(event.x(), event.y()); | 103 controller_->MouseClicked(event.x(), event.y()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void AutofillPopupViewViews::OnWidgetBoundsChanged( | 106 void AutofillPopupViewViews::OnWidgetBoundsChanged( |
| 107 views::Widget* widget, | 107 views::Widget* widget, |
| 108 const gfx::Rect& new_bounds) { | 108 const gfx::Rect& new_bounds) { |
| 109 Hide(); | 109 controller_->Hide(); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void AutofillPopupViewViews::Show() { | 112 void AutofillPopupViewViews::Show() { |
| 113 if (!GetWidget()) { | 113 if (!GetWidget()) { |
| 114 // The widget is destroyed by the corresponding NativeWidget, so we use | 114 // The widget is destroyed by the corresponding NativeWidget, so we use |
| 115 // a weak pointer to hold the reference and don't have to worry about | 115 // a weak pointer to hold the reference and don't have to worry about |
| 116 // deletion. | 116 // deletion. |
| 117 views::Widget* widget = new views::Widget; | 117 views::Widget* widget = new views::Widget; |
| 118 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 118 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
| 119 params.delegate = this; | 119 params.delegate = this; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 canvas->GetStringWidth(controller_->subtexts()[index], | 215 canvas->GetStringWidth(controller_->subtexts()[index], |
| 216 controller_->subtext_font()), | 216 controller_->subtext_font()), |
| 217 entry_rect.height(), | 217 entry_rect.height(), |
| 218 gfx::Canvas::TEXT_ALIGN_CENTER); | 218 gfx::Canvas::TEXT_ALIGN_CENTER); |
| 219 } | 219 } |
| 220 | 220 |
| 221 AutofillPopupView* AutofillPopupView::Create( | 221 AutofillPopupView* AutofillPopupView::Create( |
| 222 AutofillPopupController* controller) { | 222 AutofillPopupController* controller) { |
| 223 return new AutofillPopupViewViews(controller); | 223 return new AutofillPopupViewViews(controller); |
| 224 } | 224 } |
| OLD | NEW |