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

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

Issue 2626013005: Change CaptureSynchronizer and PointerWatcherEventRouter to support multiple CaptureClients. (Closed)
Patch Set: fix leak in test 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 }
17 } 21 }
18 22
19 namespace ui { 23 namespace ui {
20 class PointerEvent; 24 class PointerEvent;
21 } 25 }
22 26
23 namespace views { 27 namespace views {
24 28
25 class PointerWatcher; 29 class PointerWatcher;
26 class PointerWatcherEventRouterTest; 30 class PointerWatcherEventRouterTest;
(...skipping 22 matching lines...) Expand all
49 aura::WindowTreeClient* window_tree_client); 53 aura::WindowTreeClient* window_tree_client);
50 ~PointerWatcherEventRouter() override; 54 ~PointerWatcherEventRouter() override;
51 55
52 void AddPointerWatcher(PointerWatcher* watcher, bool wants_moves); 56 void AddPointerWatcher(PointerWatcher* watcher, bool wants_moves);
53 void RemovePointerWatcher(PointerWatcher* watcher); 57 void RemovePointerWatcher(PointerWatcher* watcher);
54 58
55 // Called by WindowTreeClientDelegate to notify PointerWatchers appropriately. 59 // Called by WindowTreeClientDelegate to notify PointerWatchers appropriately.
56 void OnPointerEventObserved(const ui::PointerEvent& event, 60 void OnPointerEventObserved(const ui::PointerEvent& event,
57 aura::Window* target); 61 aura::Window* target);
58 62
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
59 private: 67 private:
60 friend class PointerWatcherEventRouterTest; 68 friend class PointerWatcherEventRouterTest;
61 69
62 // Determines EventTypes based on the number and type of PointerWatchers. 70 // Determines EventTypes based on the number and type of PointerWatchers.
63 EventTypes DetermineEventTypes(); 71 EventTypes DetermineEventTypes();
64 72
65 // aura::WindowTreeClientObserver: 73 // aura::WindowTreeClientObserver:
66 void OnDidDestroyClient(aura::WindowTreeClient* client) override; 74 void OnDidDestroyClient(aura::WindowTreeClient* client) override;
67 75
68 // aura::client::CaptureClientObserver: 76 // aura::client::CaptureClientObserver:
69 void OnCaptureChanged(aura::Window* lost_capture, 77 void OnCaptureChanged(aura::Window* lost_capture,
70 aura::Window* gained_capture) override; 78 aura::Window* gained_capture) override;
71 79
72 aura::WindowTreeClient* window_tree_client_; 80 aura::WindowTreeClient* window_tree_client_;
73 // The true parameter to ObserverList indicates the list must be empty on 81 // The true parameter to ObserverList indicates the list must be empty on
74 // destruction. Two sets of observers are maintained, one for observers not 82 // destruction. Two sets of observers are maintained, one for observers not
75 // needing moves |non_move_watchers_| and |move_watchers_| for those 83 // needing moves |non_move_watchers_| and |move_watchers_| for those
76 // observers wanting moves too. 84 // observers wanting moves too.
77 base::ObserverList<views::PointerWatcher, true> non_move_watchers_; 85 base::ObserverList<views::PointerWatcher, true> non_move_watchers_;
78 base::ObserverList<views::PointerWatcher, true> move_watchers_; 86 base::ObserverList<views::PointerWatcher, true> move_watchers_;
79 87
80 EventTypes event_types_ = EventTypes::NONE; 88 EventTypes event_types_ = EventTypes::NONE;
81 89
82 DISALLOW_COPY_AND_ASSIGN(PointerWatcherEventRouter); 90 DISALLOW_COPY_AND_ASSIGN(PointerWatcherEventRouter);
83 }; 91 };
84 92
85 } // namespace views 93 } // namespace views
86 94
87 #endif // UI_VIEWS_MUS_POINTER_WATCHER_EVENT_ROUTER_H_ 95 #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