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