OLD | NEW |
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> |
(...skipping 10 matching lines...) Expand all Loading... |
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 PointerWatcher; | 30 class PointerWatcher; |
| 31 class TouchEventWatcher; |
31 class ScreenMus; | 32 class ScreenMus; |
32 namespace internal { | 33 namespace internal { |
33 class NativeWidgetDelegate; | 34 class NativeWidgetDelegate; |
34 } | 35 } |
35 | 36 |
36 // Provides configuration to mus in views. This consists of the following: | 37 // Provides configuration to mus in views. This consists of the following: |
37 // . Provides a Screen implementation backed by mus. | 38 // . Provides a Screen implementation backed by mus. |
38 // . Provides a Clipboard implementation backed by mus. | 39 // . Provides a Clipboard implementation backed by mus. |
39 // . Creates and owns a WindowTreeClient. | 40 // . Creates and owns a WindowTreeClient. |
40 // . 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 Loading... |
60 const std::map<std::string, std::vector<uint8_t>>& properties); | 61 const std::map<std::string, std::vector<uint8_t>>& properties); |
61 | 62 |
62 NativeWidget* CreateNativeWidgetMus( | 63 NativeWidget* CreateNativeWidgetMus( |
63 const std::map<std::string, std::vector<uint8_t>>& properties, | 64 const std::map<std::string, std::vector<uint8_t>>& properties, |
64 const Widget::InitParams& init_params, | 65 const Widget::InitParams& init_params, |
65 internal::NativeWidgetDelegate* delegate); | 66 internal::NativeWidgetDelegate* delegate); |
66 | 67 |
67 void AddPointerWatcher(PointerWatcher* watcher); | 68 void AddPointerWatcher(PointerWatcher* watcher); |
68 void RemovePointerWatcher(PointerWatcher* watcher); | 69 void RemovePointerWatcher(PointerWatcher* watcher); |
69 | 70 |
| 71 void AddTouchEventWatcher(TouchEventWatcher* watcher); |
| 72 void RemoveTouchEventWatcher(TouchEventWatcher* watcher); |
| 73 |
70 const std::set<ui::Window*>& GetRoots() const; | 74 const std::set<ui::Window*>& GetRoots() const; |
71 | 75 |
72 private: | 76 private: |
73 friend class WindowManagerConnectionTest; | 77 friend class WindowManagerConnectionTest; |
74 | 78 |
75 WindowManagerConnection(shell::Connector* connector, | 79 WindowManagerConnection(shell::Connector* connector, |
76 const shell::Identity& identity); | 80 const shell::Identity& identity); |
77 | 81 |
78 // Returns true if there is one or more pointer watchers for this client. | 82 // Returns true if there is one or more watchers for this client. |
79 bool HasPointerWatcher(); | 83 bool HasPointerWatcher(); |
| 84 bool HasTouchEventWatcher(); |
80 | 85 |
81 // ui::WindowTreeClientDelegate: | 86 // ui::WindowTreeClientDelegate: |
82 void OnEmbed(ui::Window* root) override; | 87 void OnEmbed(ui::Window* root) override; |
83 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | 88 void OnDidDestroyClient(ui::WindowTreeClient* client) override; |
84 void OnEventObserved(const ui::Event& event, ui::Window* target) override; | 89 void OnEventObserved(const ui::Event& event, ui::Window* target) override; |
85 | 90 |
86 // ScreenMusDelegate: | 91 // ScreenMusDelegate: |
87 void OnWindowManagerFrameValuesChanged() override; | 92 void OnWindowManagerFrameValuesChanged() override; |
88 gfx::Point GetCursorScreenPoint() override; | 93 gfx::Point GetCursorScreenPoint() override; |
89 | 94 |
90 shell::Connector* connector_; | 95 shell::Connector* connector_; |
91 shell::Identity identity_; | 96 shell::Identity identity_; |
92 std::unique_ptr<ScreenMus> screen_; | 97 std::unique_ptr<ScreenMus> screen_; |
93 std::unique_ptr<ui::WindowTreeClient> client_; | 98 std::unique_ptr<ui::WindowTreeClient> client_; |
94 // Must be empty on destruction. | 99 // Must be empty on destruction. |
95 base::ObserverList<PointerWatcher, true> pointer_watchers_; | 100 base::ObserverList<PointerWatcher, true> pointer_watchers_; |
| 101 base::ObserverList<TouchEventWatcher, true> touch_event_watchers_; |
96 | 102 |
97 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 103 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
98 }; | 104 }; |
99 | 105 |
100 } // namespace views | 106 } // namespace views |
101 | 107 |
102 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 108 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
OLD | NEW |