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

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

Issue 2163453002: mus: Change PointerWatcher to watch for all events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AddPointerEventWatcher Created 4 years, 5 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 | ui/views/mus/window_manager_connection.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_WINDOW_MANAGER_CONNECTION_H_ 5 #ifndef UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_
6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ 6 #define UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "services/shell/public/cpp/identity.h" 17 #include "services/shell/public/cpp/identity.h"
18 #include "services/ui/public/cpp/window_tree_client_delegate.h" 18 #include "services/ui/public/cpp/window_tree_client_delegate.h"
19 #include "ui/views/mus/mus_export.h" 19 #include "ui/views/mus/mus_export.h"
20 #include "ui/views/mus/screen_mus_delegate.h" 20 #include "ui/views/mus/screen_mus_delegate.h"
21 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
22 22
23 namespace shell { 23 namespace shell {
24 class Connector; 24 class Connector;
25 } 25 }
26 26
27 namespace views { 27 namespace views {
28 class ClipboardMus; 28 class ClipboardMus;
29 class NativeWidget; 29 class NativeWidget;
30 class PointerEventWatcher;
30 class PointerWatcher; 31 class PointerWatcher;
31 class TouchEventWatcher;
32 class ScreenMus; 32 class ScreenMus;
33 namespace internal { 33 namespace internal {
34 class NativeWidgetDelegate; 34 class NativeWidgetDelegate;
35 } 35 }
36 36
37 // Provides configuration to mus in views. This consists of the following: 37 // Provides configuration to mus in views. This consists of the following:
38 // . Provides a Screen implementation backed by mus. 38 // . Provides a Screen implementation backed by mus.
39 // . Provides a Clipboard implementation backed by mus. 39 // . Provides a Clipboard implementation backed by mus.
40 // . Creates and owns a WindowTreeClient. 40 // . Creates and owns a WindowTreeClient.
41 // . Registers itself as the factory for creating NativeWidgets so that a 41 // . Registers itself as the factory for creating NativeWidgets so that a
(...skipping 19 matching lines...) Expand all
61 const std::map<std::string, std::vector<uint8_t>>& properties); 61 const std::map<std::string, std::vector<uint8_t>>& properties);
62 62
63 NativeWidget* CreateNativeWidgetMus( 63 NativeWidget* CreateNativeWidgetMus(
64 const std::map<std::string, std::vector<uint8_t>>& properties, 64 const std::map<std::string, std::vector<uint8_t>>& properties,
65 const Widget::InitParams& init_params, 65 const Widget::InitParams& init_params,
66 internal::NativeWidgetDelegate* delegate); 66 internal::NativeWidgetDelegate* delegate);
67 67
68 void AddPointerWatcher(PointerWatcher* watcher); 68 void AddPointerWatcher(PointerWatcher* watcher);
69 void RemovePointerWatcher(PointerWatcher* watcher); 69 void RemovePointerWatcher(PointerWatcher* watcher);
70 70
71 void AddTouchEventWatcher(TouchEventWatcher* watcher); 71 void AddPointerEventWatcher(PointerEventWatcher* watcher,
72 void RemoveTouchEventWatcher(TouchEventWatcher* watcher); 72 ui::EventPointerType type);
73 void RemovePointerEventWatcher(PointerEventWatcher* watcher,
74 ui::EventPointerType type);
73 75
74 const std::set<ui::Window*>& GetRoots() const; 76 const std::set<ui::Window*>& GetRoots() const;
75 77
76 private: 78 private:
77 friend class WindowManagerConnectionTest; 79 friend class WindowManagerConnectionTest;
78 80
79 WindowManagerConnection(shell::Connector* connector, 81 WindowManagerConnection(shell::Connector* connector,
80 const shell::Identity& identity); 82 const shell::Identity& identity);
81 83
82 // Returns true if there is one or more watchers for this client. 84 // Returns true if there is one or more watchers for this client.
83 bool HasPointerWatcher(); 85 bool HasPointerWatcher();
84 bool HasTouchEventWatcher(); 86 bool HasTouchEventWatcher();
87 bool HasMouseEventWatcher();
85 88
86 // ui::WindowTreeClientDelegate: 89 // ui::WindowTreeClientDelegate:
87 void OnEmbed(ui::Window* root) override; 90 void OnEmbed(ui::Window* root) override;
88 void OnDidDestroyClient(ui::WindowTreeClient* client) override; 91 void OnDidDestroyClient(ui::WindowTreeClient* client) override;
89 void OnEventObserved(const ui::Event& event, ui::Window* target) override; 92 void OnEventObserved(const ui::Event& event, ui::Window* target) override;
90 93
91 // ScreenMusDelegate: 94 // ScreenMusDelegate:
92 void OnWindowManagerFrameValuesChanged() override; 95 void OnWindowManagerFrameValuesChanged() override;
93 gfx::Point GetCursorScreenPoint() override; 96 gfx::Point GetCursorScreenPoint() override;
94 97
95 shell::Connector* connector_; 98 shell::Connector* connector_;
96 shell::Identity identity_; 99 shell::Identity identity_;
97 std::unique_ptr<ScreenMus> screen_; 100 std::unique_ptr<ScreenMus> screen_;
98 std::unique_ptr<ui::WindowTreeClient> client_; 101 std::unique_ptr<ui::WindowTreeClient> client_;
99 // Must be empty on destruction. 102 // Must be empty on destruction.
100 base::ObserverList<PointerWatcher, true> pointer_watchers_; 103 base::ObserverList<PointerWatcher, true> pointer_watchers_;
101 base::ObserverList<TouchEventWatcher, true> touch_event_watchers_; 104 base::ObserverList<PointerEventWatcher, true> touch_event_watchers_;
105 base::ObserverList<PointerEventWatcher, true> mouse_event_watchers_;
sadrul 2016/07/20 16:14:54 Can this be an ObserverList<> pointer_event_watche
102 106
103 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); 107 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection);
104 }; 108 };
105 109
106 } // namespace views 110 } // namespace views
107 111
108 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ 112 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/window_manager_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698