| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/autoclick/autoclick_controller.h" | 5 #include "ash/autoclick/autoclick_controller.h" |
| 6 | 6 |
| 7 #include "ash/autoclick/common/autoclick_controller_common.h" | 7 #include "ash/autoclick/common/autoclick_controller_common.h" |
| 8 #include "ash/autoclick/common/autoclick_controller_common_delegate.h" | 8 #include "ash/autoclick/common/autoclick_controller_common_delegate.h" |
| 9 #include "ash/common/wm/root_window_finder.h" | 9 #include "ash/common/wm/root_window_finder.h" |
| 10 #include "ash/common/wm_window.h" | 10 #include "ash/common/wm_window.h" |
| 11 #include "ash/public/cpp/shell_window_ids.h" | 11 #include "ash/public/cpp/shell_window_ids.h" |
| 12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
| 13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
| 16 #include "ui/events/event.h" | 16 #include "ui/events/event.h" |
| 17 #include "ui/events/event_handler.h" | 17 #include "ui/events/event_handler.h" |
| 18 #include "ui/events/event_processor.h" | 18 #include "ui/events/event_sink.h" |
| 19 #include "ui/events/event_utils.h" | 19 #include "ui/events/event_utils.h" |
| 20 #include "ui/views/widget/widget.h" | 20 #include "ui/views/widget/widget.h" |
| 21 #include "ui/wm/core/coordinate_conversion.h" | 21 #include "ui/wm/core/coordinate_conversion.h" |
| 22 | 22 |
| 23 namespace ash { | 23 namespace ash { |
| 24 | 24 |
| 25 // static. | 25 // static. |
| 26 base::TimeDelta AutoclickController::GetDefaultAutoclickDelay() { | 26 base::TimeDelta AutoclickController::GetDefaultAutoclickDelay() { |
| 27 return base::TimeDelta::FromMilliseconds(int64_t{kDefaultAutoclickDelayMs}); | 27 return base::TimeDelta::FromMilliseconds(int64_t{kDefaultAutoclickDelayMs}); |
| 28 } | 28 } |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, | 185 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, |
| 186 click_location, ui::EventTimeForNow(), | 186 click_location, ui::EventTimeForNow(), |
| 187 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, | 187 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, |
| 188 ui::EF_LEFT_MOUSE_BUTTON); | 188 ui::EF_LEFT_MOUSE_BUTTON); |
| 189 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, click_location, | 189 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, click_location, |
| 190 click_location, ui::EventTimeForNow(), | 190 click_location, ui::EventTimeForNow(), |
| 191 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, | 191 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, |
| 192 ui::EF_LEFT_MOUSE_BUTTON); | 192 ui::EF_LEFT_MOUSE_BUTTON); |
| 193 | 193 |
| 194 ui::EventDispatchDetails details = | 194 ui::EventDispatchDetails details = |
| 195 host->event_processor()->OnEventFromSource(&press_event); | 195 host->event_sink()->OnEventFromSource(&press_event); |
| 196 if (!details.dispatcher_destroyed) | 196 if (!details.dispatcher_destroyed) |
| 197 details = host->event_processor()->OnEventFromSource(&release_event); | 197 details = host->event_sink()->OnEventFromSource(&release_event); |
| 198 if (details.dispatcher_destroyed) | 198 if (details.dispatcher_destroyed) |
| 199 return; | 199 return; |
| 200 } | 200 } |
| 201 | 201 |
| 202 void AutoclickControllerImpl::OnAutoclickCanceled() { | 202 void AutoclickControllerImpl::OnAutoclickCanceled() { |
| 203 SetTapDownTarget(nullptr); | 203 SetTapDownTarget(nullptr); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void AutoclickControllerImpl::OnWindowDestroying(aura::Window* window) { | 206 void AutoclickControllerImpl::OnWindowDestroying(aura::Window* window) { |
| 207 DCHECK_EQ(tap_down_target_, window); | 207 DCHECK_EQ(tap_down_target_, window); |
| 208 autoclick_controller_common_->CancelAutoclick(); | 208 autoclick_controller_common_->CancelAutoclick(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 // static. | 211 // static. |
| 212 AutoclickController* AutoclickController::CreateInstance() { | 212 AutoclickController* AutoclickController::CreateInstance() { |
| 213 return new AutoclickControllerImpl(); | 213 return new AutoclickControllerImpl(); |
| 214 } | 214 } |
| 215 | 215 |
| 216 } // namespace ash | 216 } // namespace ash |
| OLD | NEW |