Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(444)

Side by Side Diff: ash/autoclick/autoclick_controller.cc

Issue 2786693002: Add PointerDetails to ui::MouseEvent's constructors (Closed)
Patch Set: mouse event constructor Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 const int mouse_event_flags) { 175 const int mouse_event_flags) {
176 aura::Window* root_window = 176 aura::Window* root_window =
177 WmWindow::GetAuraWindow(wm::GetRootWindowAt(event_location)); 177 WmWindow::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->ConvertDIPToPixels(&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(
186 click_location, ui::EventTimeForNow(), 186 ui::ET_MOUSE_PRESSED, click_location, click_location,
187 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, 187 ui::EventTimeForNow(), 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::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
190 click_location, ui::EventTimeForNow(), 190 ui::PointerEvent::kMousePointerId));
191 mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON, 191 ui::MouseEvent release_event(
192 ui::EF_LEFT_MOUSE_BUTTON); 192 ui::ET_MOUSE_RELEASED, click_location, click_location,
193 ui::EventTimeForNow(), mouse_event_flags | ui::EF_LEFT_MOUSE_BUTTON,
194 ui::EF_LEFT_MOUSE_BUTTON,
195 ui::PointerDetails(ui::EventPointerType::POINTER_TYPE_MOUSE,
196 ui::PointerEvent::kMousePointerId));
193 197
194 ui::EventDispatchDetails details = 198 ui::EventDispatchDetails details =
195 host->event_sink()->OnEventFromSource(&press_event); 199 host->event_sink()->OnEventFromSource(&press_event);
196 if (!details.dispatcher_destroyed) 200 if (!details.dispatcher_destroyed)
197 details = host->event_sink()->OnEventFromSource(&release_event); 201 details = host->event_sink()->OnEventFromSource(&release_event);
198 if (details.dispatcher_destroyed) 202 if (details.dispatcher_destroyed)
199 return; 203 return;
200 } 204 }
201 205
202 void AutoclickControllerImpl::OnAutoclickCanceled() { 206 void AutoclickControllerImpl::OnAutoclickCanceled() {
203 SetTapDownTarget(nullptr); 207 SetTapDownTarget(nullptr);
204 } 208 }
205 209
206 void AutoclickControllerImpl::OnWindowDestroying(aura::Window* window) { 210 void AutoclickControllerImpl::OnWindowDestroying(aura::Window* window) {
207 DCHECK_EQ(tap_down_target_, window); 211 DCHECK_EQ(tap_down_target_, window);
208 autoclick_controller_common_->CancelAutoclick(); 212 autoclick_controller_common_->CancelAutoclick();
209 } 213 }
210 214
211 // static. 215 // static.
212 AutoclickController* AutoclickController::CreateInstance() { 216 AutoclickController* AutoclickController::CreateInstance() {
213 return new AutoclickControllerImpl(); 217 return new AutoclickControllerImpl();
214 } 218 }
215 219
216 } // namespace ash 220 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698