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

Side by Side Diff: ui/views/mus/pointer_watcher_event_router.h

Issue 2674683002: Revert: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients (Closed)
Patch Set: Created 3 years, 10 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 | « ui/views/mus/mus_client.cc ('k') | ui/views/mus/pointer_watcher_event_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_ 5 #ifndef UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_
6 #define UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_ 6 #define UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/observer_list.h" 10 #include "base/observer_list.h"
11 #include "ui/aura/client/capture_client_observer.h" 11 #include "ui/aura/client/capture_client_observer.h"
12 #include "ui/aura/mus/window_tree_client_observer.h" 12 #include "ui/aura/mus/window_tree_client_observer.h"
13 #include "ui/views/mus/mus_export.h" 13 #include "ui/views/mus/mus_export.h"
14 14
15 namespace aura { 15 namespace aura {
16 class WindowTreeClient; 16 class WindowTreeClient;
17
18 namespace client {
19 class CaptureClient;
20 }
21 } 17 }
22 18
23 namespace ui { 19 namespace ui {
24 class PointerEvent; 20 class PointerEvent;
25 } 21 }
26 22
27 namespace views { 23 namespace views {
28 24
29 class PointerWatcher; 25 class PointerWatcher;
30 class PointerWatcherEventRouterTest; 26 class PointerWatcherEventRouterTest;
(...skipping 22 matching lines...) Expand all
53 aura::WindowTreeClient* window_tree_client); 49 aura::WindowTreeClient* window_tree_client);
54 ~PointerWatcherEventRouter() override; 50 ~PointerWatcherEventRouter() override;
55 51
56 void AddPointerWatcher(PointerWatcher* watcher, bool wants_moves); 52 void AddPointerWatcher(PointerWatcher* watcher, bool wants_moves);
57 void RemovePointerWatcher(PointerWatcher* watcher); 53 void RemovePointerWatcher(PointerWatcher* watcher);
58 54
59 // Called by WindowTreeClientDelegate to notify PointerWatchers appropriately. 55 // Called by WindowTreeClientDelegate to notify PointerWatchers appropriately.
60 void OnPointerEventObserved(const ui::PointerEvent& event, 56 void OnPointerEventObserved(const ui::PointerEvent& event,
61 aura::Window* target); 57 aura::Window* target);
62 58
63 // Called when the |capture_client| has been set or will be unset.
64 void AttachToCaptureClient(aura::client::CaptureClient* capture_client);
65 void DetachFromCaptureClient(aura::client::CaptureClient* capture_client);
66
67 private: 59 private:
68 friend class PointerWatcherEventRouterTest; 60 friend class PointerWatcherEventRouterTest;
69 61
70 // Determines EventTypes based on the number and type of PointerWatchers. 62 // Determines EventTypes based on the number and type of PointerWatchers.
71 EventTypes DetermineEventTypes(); 63 EventTypes DetermineEventTypes();
72 64
73 // aura::WindowTreeClientObserver: 65 // aura::WindowTreeClientObserver:
74 void OnDidDestroyClient(aura::WindowTreeClient* client) override; 66 void OnDidDestroyClient(aura::WindowTreeClient* client) override;
75 67
76 // aura::client::CaptureClientObserver: 68 // aura::client::CaptureClientObserver:
77 void OnCaptureChanged(aura::Window* lost_capture, 69 void OnCaptureChanged(aura::Window* lost_capture,
78 aura::Window* gained_capture) override; 70 aura::Window* gained_capture) override;
79 71
80 aura::WindowTreeClient* window_tree_client_; 72 aura::WindowTreeClient* window_tree_client_;
81 // The true parameter to ObserverList indicates the list must be empty on 73 // The true parameter to ObserverList indicates the list must be empty on
82 // destruction. Two sets of observers are maintained, one for observers not 74 // destruction. Two sets of observers are maintained, one for observers not
83 // needing moves |non_move_watchers_| and |move_watchers_| for those 75 // needing moves |non_move_watchers_| and |move_watchers_| for those
84 // observers wanting moves too. 76 // observers wanting moves too.
85 base::ObserverList<views::PointerWatcher, true> non_move_watchers_; 77 base::ObserverList<views::PointerWatcher, true> non_move_watchers_;
86 base::ObserverList<views::PointerWatcher, true> move_watchers_; 78 base::ObserverList<views::PointerWatcher, true> move_watchers_;
87 79
88 EventTypes event_types_ = EventTypes::NONE; 80 EventTypes event_types_ = EventTypes::NONE;
89 81
90 DISALLOW_COPY_AND_ASSIGN(PointerWatcherEventRouter); 82 DISALLOW_COPY_AND_ASSIGN(PointerWatcherEventRouter);
91 }; 83 };
92 84
93 } // namespace views 85 } // namespace views
94 86
95 #endif // UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_ 87 #endif // UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « ui/views/mus/mus_client.cc ('k') | ui/views/mus/pointer_watcher_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698