| 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/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/wm/coordinate_conversion.h" | 8 #include "ash/wm/coordinate_conversion.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "ui/aura/env.h" | 10 #include "ui/aura/env.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 aura::Window* root_window = wm::GetRootWindowAt(screen_location); | 184 aura::Window* root_window = wm::GetRootWindowAt(screen_location); |
| 185 DCHECK(root_window) << "Root window not found while attempting autoclick."; | 185 DCHECK(root_window) << "Root window not found while attempting autoclick."; |
| 186 | 186 |
| 187 gfx::Point click_location(screen_location); | 187 gfx::Point click_location(screen_location); |
| 188 anchor_location_ = click_location; | 188 anchor_location_ = click_location; |
| 189 | 189 |
| 190 ::wm::ConvertPointFromScreen(root_window, &click_location); | 190 ::wm::ConvertPointFromScreen(root_window, &click_location); |
| 191 aura::WindowTreeHost* host = root_window->GetHost(); | 191 aura::WindowTreeHost* host = root_window->GetHost(); |
| 192 host->ConvertPointToHost(&click_location); | 192 host->ConvertPointToHost(&click_location); |
| 193 | 193 |
| 194 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, | 194 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, gfx::PointF(click_location), |
| 195 click_location, ui::EventTimeForNow(), | 195 gfx::PointF(click_location), ui::EventTimeForNow(), |
| 196 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, | 196 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, |
| 197 ui::EF_LEFT_MOUSE_BUTTON); | 197 ui::EF_LEFT_MOUSE_BUTTON); |
| 198 ui::MouseEvent release_event(ui::ET_MOUSE_RELEASED, click_location, | 198 ui::MouseEvent release_event( |
| 199 click_location, ui::EventTimeForNow(), | 199 ui::ET_MOUSE_RELEASED, gfx::PointF(click_location), |
| 200 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, | 200 gfx::PointF(click_location), ui::EventTimeForNow(), |
| 201 ui::EF_LEFT_MOUSE_BUTTON); | 201 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); |
| 202 | 202 |
| 203 ui::EventDispatchDetails details = | 203 ui::EventDispatchDetails details = |
| 204 host->event_processor()->OnEventFromSource(&press_event); | 204 host->event_processor()->OnEventFromSource(&press_event); |
| 205 if (!details.dispatcher_destroyed) | 205 if (!details.dispatcher_destroyed) |
| 206 details = host->event_processor()->OnEventFromSource(&release_event); | 206 details = host->event_processor()->OnEventFromSource(&release_event); |
| 207 if (details.dispatcher_destroyed) | 207 if (details.dispatcher_destroyed) |
| 208 return; | 208 return; |
| 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 |