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/aura/wm_window_aura.h" |
8 #include "ash/autoclick/common/autoclick_controller_common.h" | 8 #include "ash/autoclick/common/autoclick_controller_common.h" |
9 #include "ash/autoclick/common/autoclick_controller_common_delegate.h" | 9 #include "ash/autoclick/common/autoclick_controller_common_delegate.h" |
10 #include "ash/common/wm/root_window_finder.h" | 10 #include "ash/common/wm/root_window_finder.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 void AutoclickControllerImpl::DoAutoclick(const gfx::Point& event_location, | 174 void AutoclickControllerImpl::DoAutoclick(const gfx::Point& event_location, |
175 const int mouse_event_flags) { | 175 const int mouse_event_flags) { |
176 aura::Window* root_window = | 176 aura::Window* root_window = |
177 WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(event_location)); | 177 WmWindowAura::GetAuraWindow(wm::GetRootWindowAt(event_location)); |
178 DCHECK(root_window) << "Root window not found while attempting autoclick."; | 178 DCHECK(root_window) << "Root window not found while attempting autoclick."; |
179 | 179 |
180 gfx::Point click_location(event_location); | 180 gfx::Point click_location(event_location); |
181 ::wm::ConvertPointFromScreen(root_window, &click_location); | 181 ::wm::ConvertPointFromScreen(root_window, &click_location); |
182 aura::WindowTreeHost* host = root_window->GetHost(); | 182 aura::WindowTreeHost* host = root_window->GetHost(); |
183 host->ConvertPointToHost(&click_location); | 183 host->ConvertDIPToPixels(&click_location); |
184 | 184 |
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 |
(...skipping 13 matching lines...) Expand all Loading... |
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 |