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 15 matching lines...) Expand all Loading... |
26 } | 26 } |
27 | 27 |
28 namespace ui { | 28 namespace ui { |
29 class GpuService; | 29 class GpuService; |
30 } | 30 } |
31 | 31 |
32 namespace views { | 32 namespace views { |
33 class ClipboardMus; | 33 class ClipboardMus; |
34 class NativeWidget; | 34 class NativeWidget; |
35 class PointerWatcher; | 35 class PointerWatcher; |
36 class TouchEventWatcher; | |
37 class ScreenMus; | 36 class ScreenMus; |
38 namespace internal { | 37 namespace internal { |
39 class NativeWidgetDelegate; | 38 class NativeWidgetDelegate; |
40 } | 39 } |
41 | 40 |
42 // Provides configuration to mus in views. This consists of the following: | 41 // Provides configuration to mus in views. This consists of the following: |
43 // . Provides a Screen implementation backed by mus. | 42 // . Provides a Screen implementation backed by mus. |
44 // . Provides a Clipboard implementation backed by mus. | 43 // . Provides a Clipboard implementation backed by mus. |
45 // . Creates and owns a WindowTreeClient. | 44 // . Creates and owns a WindowTreeClient. |
46 // . Registers itself as the factory for creating NativeWidgets so that a | 45 // . Registers itself as the factory for creating NativeWidgets so that a |
(...skipping 18 matching lines...) Expand all Loading... |
65 ui::GpuService* gpu_service() { return gpu_service_.get(); } | 64 ui::GpuService* gpu_service() { return gpu_service_.get(); } |
66 | 65 |
67 ui::Window* NewWindow( | 66 ui::Window* NewWindow( |
68 const std::map<std::string, std::vector<uint8_t>>& properties); | 67 const std::map<std::string, std::vector<uint8_t>>& properties); |
69 | 68 |
70 NativeWidget* CreateNativeWidgetMus( | 69 NativeWidget* CreateNativeWidgetMus( |
71 const std::map<std::string, std::vector<uint8_t>>& properties, | 70 const std::map<std::string, std::vector<uint8_t>>& properties, |
72 const Widget::InitParams& init_params, | 71 const Widget::InitParams& init_params, |
73 internal::NativeWidgetDelegate* delegate); | 72 internal::NativeWidgetDelegate* delegate); |
74 | 73 |
75 void AddPointerWatcher(PointerWatcher* watcher); | 74 void AddPointerWatcher(PointerWatcher* watcher, bool want_moves); |
76 void RemovePointerWatcher(PointerWatcher* watcher); | 75 void RemovePointerWatcher(PointerWatcher* watcher); |
77 | 76 |
78 void AddTouchEventWatcher(TouchEventWatcher* watcher); | |
79 void RemoveTouchEventWatcher(TouchEventWatcher* watcher); | |
80 | |
81 const std::set<ui::Window*>& GetRoots() const; | 77 const std::set<ui::Window*>& GetRoots() const; |
82 | 78 |
83 private: | 79 private: |
84 friend class WindowManagerConnectionTest; | 80 friend class WindowManagerConnectionTest; |
85 | 81 |
86 WindowManagerConnection(shell::Connector* connector, | 82 WindowManagerConnection(shell::Connector* connector, |
87 const shell::Identity& identity); | 83 const shell::Identity& identity); |
88 | 84 |
89 // Returns true if there is one or more watchers for this client. | 85 // Returns true if there is one or more watchers for this client. |
90 bool HasPointerWatcher(); | 86 bool HasPointerWatcher(); |
91 bool HasTouchEventWatcher(); | |
92 | 87 |
93 // ui::WindowTreeClientDelegate: | 88 // ui::WindowTreeClientDelegate: |
94 void OnEmbed(ui::Window* root) override; | 89 void OnEmbed(ui::Window* root) override; |
95 void OnDidDestroyClient(ui::WindowTreeClient* client) override; | 90 void OnDidDestroyClient(ui::WindowTreeClient* client) override; |
96 void OnEventObserved(const ui::Event& event, ui::Window* target) override; | 91 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 92 ui::Window* target) override; |
97 | 93 |
98 // ScreenMusDelegate: | 94 // ScreenMusDelegate: |
99 void OnWindowManagerFrameValuesChanged() override; | 95 void OnWindowManagerFrameValuesChanged() override; |
100 gfx::Point GetCursorScreenPoint() override; | 96 gfx::Point GetCursorScreenPoint() override; |
101 | 97 |
102 // ui:OSExchangeDataProviderFactory::Factory: | 98 // ui:OSExchangeDataProviderFactory::Factory: |
103 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; | 99 std::unique_ptr<OSExchangeData::Provider> BuildProvider() override; |
104 | 100 |
105 shell::Connector* connector_; | 101 shell::Connector* connector_; |
106 shell::Identity identity_; | 102 shell::Identity identity_; |
107 std::unique_ptr<ScreenMus> screen_; | 103 std::unique_ptr<ScreenMus> screen_; |
108 std::unique_ptr<ui::WindowTreeClient> client_; | 104 std::unique_ptr<ui::WindowTreeClient> client_; |
109 std::unique_ptr<ui::GpuService> gpu_service_; | 105 std::unique_ptr<ui::GpuService> gpu_service_; |
110 // Must be empty on destruction. | 106 // Must be empty on destruction. |
111 base::ObserverList<PointerWatcher, true> pointer_watchers_; | 107 base::ObserverList<PointerWatcher, true> pointer_watchers_; |
112 base::ObserverList<TouchEventWatcher, true> touch_event_watchers_; | 108 bool pointer_watcher_want_moves_; |
113 | 109 |
114 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); | 110 DISALLOW_COPY_AND_ASSIGN(WindowManagerConnection); |
115 }; | 111 }; |
116 | 112 |
117 } // namespace views | 113 } // namespace views |
118 | 114 |
119 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ | 115 #endif // UI_VIEWS_MUS_WINDOW_MANAGER_CONNECTION_H_ |
OLD | NEW |