| 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/aura/wm_window_aura.h" |
| 9 #include "ash/wm/common/root_window_finder.h" |
| 9 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| 10 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 11 #include "ui/aura/window_tree_host.h" | 12 #include "ui/aura/window_tree_host.h" |
| 12 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
| 13 #include "ui/events/event_constants.h" | 14 #include "ui/events/event_constants.h" |
| 14 #include "ui/events/event_handler.h" | 15 #include "ui/events/event_handler.h" |
| 15 #include "ui/events/event_processor.h" | 16 #include "ui/events/event_processor.h" |
| 16 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
| 17 #include "ui/gfx/geometry/point.h" | 18 #include "ui/gfx/geometry/point.h" |
| 18 #include "ui/gfx/geometry/vector2d.h" | 19 #include "ui/gfx/geometry/vector2d.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 autoclick_timer_->Stop(); | 172 autoclick_timer_->Stop(); |
| 172 } | 173 } |
| 173 | 174 |
| 174 void AutoclickControllerImpl::OnScrollEvent(ui::ScrollEvent* event) { | 175 void AutoclickControllerImpl::OnScrollEvent(ui::ScrollEvent* event) { |
| 175 autoclick_timer_->Stop(); | 176 autoclick_timer_->Stop(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void AutoclickControllerImpl::DoAutoclick() { | 179 void AutoclickControllerImpl::DoAutoclick() { |
| 179 gfx::Point screen_location = | 180 gfx::Point screen_location = |
| 180 aura::Env::GetInstance()->last_mouse_location(); | 181 aura::Env::GetInstance()->last_mouse_location(); |
| 181 aura::Window* root_window = wm::GetRootWindowAt(screen_location); | 182 aura::Window* root_window = |
| 183 wm::WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(screen_location)); |
| 182 DCHECK(root_window) << "Root window not found while attempting autoclick."; | 184 DCHECK(root_window) << "Root window not found while attempting autoclick."; |
| 183 | 185 |
| 184 gfx::Point click_location(screen_location); | 186 gfx::Point click_location(screen_location); |
| 185 anchor_location_ = click_location; | 187 anchor_location_ = click_location; |
| 186 | 188 |
| 187 ::wm::ConvertPointFromScreen(root_window, &click_location); | 189 ::wm::ConvertPointFromScreen(root_window, &click_location); |
| 188 aura::WindowTreeHost* host = root_window->GetHost(); | 190 aura::WindowTreeHost* host = root_window->GetHost(); |
| 189 host->ConvertPointToHost(&click_location); | 191 host->ConvertPointToHost(&click_location); |
| 190 | 192 |
| 191 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, | 193 ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 204 if (details.dispatcher_destroyed) | 206 if (details.dispatcher_destroyed) |
| 205 return; | 207 return; |
| 206 } | 208 } |
| 207 | 209 |
| 208 // static. | 210 // static. |
| 209 AutoclickController* AutoclickController::CreateInstance() { | 211 AutoclickController* AutoclickController::CreateInstance() { |
| 210 return new AutoclickControllerImpl(); | 212 return new AutoclickControllerImpl(); |
| 211 } | 213 } |
| 212 | 214 |
| 213 } // namespace ash | 215 } // namespace ash |
| OLD | NEW |