| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_base_view.h" | 5 #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/browser/ui/autofill/popup_constants.h" | 10 #include "chrome/browser/ui/autofill/popup_constants.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 // Pressing return causes the cursor to hide, which will generate an | 136 // Pressing return causes the cursor to hide, which will generate an |
| 137 // OnMouseExited event. Pressing return should activate the current selection | 137 // OnMouseExited event. Pressing return should activate the current selection |
| 138 // via AcceleratorPressed, so we need to let that run first. | 138 // via AcceleratorPressed, so we need to let that run first. |
| 139 base::MessageLoop::current()->PostTask( | 139 base::MessageLoop::current()->PostTask( |
| 140 FROM_HERE, | 140 FROM_HERE, |
| 141 base::Bind(&AutofillPopupBaseView::ClearSelection, | 141 base::Bind(&AutofillPopupBaseView::ClearSelection, |
| 142 weak_ptr_factory_.GetWeakPtr())); | 142 weak_ptr_factory_.GetWeakPtr())); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) { | 145 void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) { |
| 146 // A synthesized mouse move will be sent when the popup is first shown. |
| 147 // Don't preview a suggestion if the mouse happens to be hovering there. |
| 148 if (event.flags() & ui::EF_IS_SYNTHESIZED) |
| 149 return; |
| 150 |
| 146 if (HitTestPoint(event.location())) | 151 if (HitTestPoint(event.location())) |
| 147 SetSelection(event.location()); | 152 SetSelection(event.location()); |
| 148 else | 153 else |
| 149 ClearSelection(); | 154 ClearSelection(); |
| 150 } | 155 } |
| 151 | 156 |
| 152 bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) { | 157 bool AutofillPopupBaseView::OnMousePressed(const ui::MouseEvent& event) { |
| 153 return event.GetClickCount() == 1; | 158 return event.GetClickCount() == 1; |
| 154 } | 159 } |
| 155 | 160 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 void AutofillPopupBaseView::HideController() { | 228 void AutofillPopupBaseView::HideController() { |
| 224 if (delegate_) | 229 if (delegate_) |
| 225 delegate_->Hide(); | 230 delegate_->Hide(); |
| 226 } | 231 } |
| 227 | 232 |
| 228 gfx::NativeView AutofillPopupBaseView::container_view() { | 233 gfx::NativeView AutofillPopupBaseView::container_view() { |
| 229 return delegate_->container_view(); | 234 return delegate_->container_view(); |
| 230 } | 235 } |
| 231 | 236 |
| 232 } // namespace autofill | 237 } // namespace autofill |
| OLD | NEW |