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

Side by Side Diff: ash/pointer_watcher_delegate_aura.cc

Issue 1921673005: mus: Add PointerWatcher for passively observing mouse and touch events (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 7 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 | « ash/pointer_watcher_delegate_aura.h ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ash/pointer_watcher_delegate_aura.h"
6
7 #include "ash/shell.h"
8 #include "ui/events/event.h"
9 #include "ui/events/event_constants.h"
10 #include "ui/views/pointer_watcher.h"
11
12 namespace ash {
13
14 PointerWatcherDelegateAura::PointerWatcherDelegateAura() {
15 Shell::GetInstance()->AddPreTargetHandler(this);
16 }
17
18 PointerWatcherDelegateAura::~PointerWatcherDelegateAura() {
19 Shell::GetInstance()->RemovePreTargetHandler(this);
20 }
21
22 void PointerWatcherDelegateAura::AddPointerWatcher(
23 views::PointerWatcher* watcher) {
24 pointer_watchers_.AddObserver(watcher);
25 }
26
27 void PointerWatcherDelegateAura::RemovePointerWatcher(
28 views::PointerWatcher* watcher) {
29 pointer_watchers_.RemoveObserver(watcher);
30 }
31
32 void PointerWatcherDelegateAura::OnMouseEvent(ui::MouseEvent* event) {
33 if (event->type() == ui::ET_MOUSE_PRESSED)
34 FOR_EACH_OBSERVER(views::PointerWatcher, pointer_watchers_,
35 OnMousePressed(*event));
36 }
37
38 void PointerWatcherDelegateAura::OnTouchEvent(ui::TouchEvent* event) {
39 if (event->type() == ui::ET_TOUCH_PRESSED)
40 FOR_EACH_OBSERVER(views::PointerWatcher, pointer_watchers_,
41 OnTouchPressed(*event));
42 }
43
44 } // namespace ash
OLDNEW
« no previous file with comments | « ash/pointer_watcher_delegate_aura.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698