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

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

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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
« no previous file with comments | « no previous file | ash/autoclick/autoclick_unittest.cc » ('j') | ui/events/event.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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(
195 click_location, ui::EventTimeForNow(), 195 ui::ET_MOUSE_PRESSED, click_location, click_location,
196 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, 196 ui::EventTimeForNow(), 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::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
199 click_location, ui::EventTimeForNow(), 199 ui::MouseEvent release_event(
200 mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON, 200 ui::ET_MOUSE_RELEASED, click_location, click_location,
201 ui::EF_LEFT_MOUSE_BUTTON); 201 ui::EventTimeForNow(), mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON,
202 ui::EF_LEFT_MOUSE_BUTTON,
203 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE));
202 204
203 ui::EventDispatchDetails details = 205 ui::EventDispatchDetails details =
204 host->event_processor()->OnEventFromSource(&press_event); 206 host->event_processor()->OnEventFromSource(&press_event);
205 if (!details.dispatcher_destroyed) 207 if (!details.dispatcher_destroyed)
206 details = host->event_processor()->OnEventFromSource(&release_event); 208 details = host->event_processor()->OnEventFromSource(&release_event);
207 if (details.dispatcher_destroyed) 209 if (details.dispatcher_destroyed)
208 return; 210 return;
209 } 211 }
210 212
211 // static. 213 // static.
212 AutoclickController* AutoclickController::CreateInstance() { 214 AutoclickController* AutoclickController::CreateInstance() {
213 return new AutoclickControllerImpl(); 215 return new AutoclickControllerImpl();
214 } 216 }
215 217
216 } // namespace ash 218 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/autoclick/autoclick_unittest.cc » ('j') | ui/events/event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698