| 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/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 // If we move off of the popup, we lose the selection. | 130 // If we move off of the popup, we lose the selection. |
| 131 ClearSelection(); | 131 ClearSelection(); |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 | 134 |
| 135 void AutofillPopupBaseView::OnMouseExited(const ui::MouseEvent& event) { | 135 void AutofillPopupBaseView::OnMouseExited(const ui::MouseEvent& event) { |
| 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::ThreadTaskRunnerHandle::Get()->PostTask( | 139 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 140 FROM_HERE, base::Bind(&AutofillPopupBaseView::ClearSelection, | 140 FROM_HERE, base::BindOnce(&AutofillPopupBaseView::ClearSelection, |
| 141 weak_ptr_factory_.GetWeakPtr())); | 141 weak_ptr_factory_.GetWeakPtr())); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) { | 144 void AutofillPopupBaseView::OnMouseMoved(const ui::MouseEvent& event) { |
| 145 // A synthesized mouse move will be sent when the popup is first shown. | 145 // A synthesized mouse move will be sent when the popup is first shown. |
| 146 // Don't preview a suggestion if the mouse happens to be hovering there. | 146 // Don't preview a suggestion if the mouse happens to be hovering there. |
| 147 #if defined(OS_WIN) | 147 #if defined(OS_WIN) |
| 148 // TODO(rouslan): Use event.time_stamp() and ui::EventTimeForNow() when they | 148 // TODO(rouslan): Use event.time_stamp() and ui::EventTimeForNow() when they |
| 149 // become comparable. http://crbug.com/453559 | 149 // become comparable. http://crbug.com/453559 |
| 150 if (base::Time::Now() - show_time_ <= base::TimeDelta::FromMilliseconds(50)) | 150 if (base::Time::Now() - show_time_ <= base::TimeDelta::FromMilliseconds(50)) |
| 151 return; | 151 return; |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 void AutofillPopupBaseView::HideController() { | 234 void AutofillPopupBaseView::HideController() { |
| 235 if (delegate_) | 235 if (delegate_) |
| 236 delegate_->Hide(); | 236 delegate_->Hide(); |
| 237 } | 237 } |
| 238 | 238 |
| 239 gfx::NativeView AutofillPopupBaseView::container_view() { | 239 gfx::NativeView AutofillPopupBaseView::container_view() { |
| 240 return delegate_->container_view(); | 240 return delegate_->container_view(); |
| 241 } | 241 } |
| 242 | 242 |
| 243 } // namespace autofill | 243 } // namespace autofill |
| OLD | NEW |