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

Side by Side Diff: components/mus/ws/window_tree_host_impl.h

Issue 1352043005: mus: Implement Window Server Capture Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added capture unit tests Created 5 years, 1 month 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
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 COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_
6 #define COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "components/mus/common/types.h" 10 #include "components/mus/common/types.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 const mojom::ViewportMetrics& GetViewportMetrics() const; 73 const mojom::ViewportMetrics& GetViewportMetrics() const;
74 74
75 ConnectionManager* connection_manager() { return connection_manager_; } 75 ConnectionManager* connection_manager() { return connection_manager_; }
76 76
77 mojom::WindowManager* window_manager() { return window_manager_.get(); } 77 mojom::WindowManager* window_manager() { return window_manager_.get(); }
78 78
79 // Returns the root ServerWindow of this viewport. 79 // Returns the root ServerWindow of this viewport.
80 ServerWindow* root_window() { return root_.get(); } 80 ServerWindow* root_window() { return root_.get(); }
81 const ServerWindow* root_window() const { return root_.get(); } 81 const ServerWindow* root_window() const { return root_.get(); }
82 82
83 void SetCapture(ServerWindow* window);
84 void ReleaseCapture(ServerWindow* window);
85
83 void SetFocusedWindow(ServerWindow* window); 86 void SetFocusedWindow(ServerWindow* window);
84 ServerWindow* GetFocusedWindow(); 87 ServerWindow* GetFocusedWindow();
85 void DestroyFocusController(); 88 void DestroyFocusController();
86 89
87 void UpdateTextInputState(ServerWindow* window, 90 void UpdateTextInputState(ServerWindow* window,
88 const ui::TextInputState& state); 91 const ui::TextInputState& state);
89 void SetImeVisibility(ServerWindow* window, bool visible); 92 void SetImeVisibility(ServerWindow* window, bool visible);
90 93
94 // Returns the window that has captured input.
95 ServerWindow* GetCaptureWindow() {
96 return event_dispatcher_.capture_window();
97 }
98 const ServerWindow* GetCaptureWindow() const {
99 return event_dispatcher_.capture_window();
100 }
91 // WindowTreeHost: 101 // WindowTreeHost:
92 void SetSize(mojo::SizePtr size) override; 102 void SetSize(mojo::SizePtr size) override;
93 void SetTitle(const mojo::String& title) override; 103 void SetTitle(const mojo::String& title) override;
94 void AddAccelerator(uint32_t id, 104 void AddAccelerator(uint32_t id,
95 mojom::EventMatcherPtr event_matcher) override; 105 mojom::EventMatcherPtr event_matcher) override;
96 void RemoveAccelerator(uint32_t id) override; 106 void RemoveAccelerator(uint32_t id) override;
97 107
98 private: 108 private:
99 void OnClientClosed(); 109 void OnClientClosed();
100 110
101 // DisplayManagerDelegate: 111 // DisplayManagerDelegate:
102 ServerWindow* GetRootWindow() override; 112 ServerWindow* GetRootWindow() override;
103 void OnEvent(mojom::EventPtr event) override; 113 void OnEvent(mojom::EventPtr event) override;
114 void OnLostCapture() override;
104 void OnDisplayClosed() override; 115 void OnDisplayClosed() override;
105 void OnViewportMetricsChanged( 116 void OnViewportMetricsChanged(
106 const mojom::ViewportMetrics& old_metrics, 117 const mojom::ViewportMetrics& old_metrics,
107 const mojom::ViewportMetrics& new_metrics) override; 118 const mojom::ViewportMetrics& new_metrics) override;
108 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override; 119 void OnTopLevelSurfaceChanged(cc::SurfaceId surface_id) override;
109 void OnCompositorFrameDrawn() override; 120 void OnCompositorFrameDrawn() override;
110 121
111 // FocusControllerDelegate: 122 // FocusControllerDelegate:
112 void OnFocusChanged(ServerWindow* old_focused_window, 123 void OnFocusChanged(ServerWindow* old_focused_window,
113 ServerWindow* new_focused_window) override; 124 ServerWindow* new_focused_window) override;
114 125
115 // EventDispatcherDelegate: 126 // EventDispatcherDelegate:
116 void OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) override; 127 void OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) override;
117 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override; 128 void SetFocusedWindowFromEventDispatcher(ServerWindow* window) override;
118 ServerWindow* GetFocusedWindowForEventDispatcher() override; 129 ServerWindow* GetFocusedWindowForEventDispatcher() override;
130 void OnLostCapture(ServerWindow* window) override;
119 void DispatchInputEventToWindow(ServerWindow* target, 131 void DispatchInputEventToWindow(ServerWindow* target,
120 bool in_nonclient_area, 132 bool in_nonclient_area,
121 mojom::EventPtr event) override; 133 mojom::EventPtr event) override;
122 134
123 // ServerWindowObserver: 135 // ServerWindowObserver:
124 void OnWindowDestroyed(ServerWindow* window) override; 136 void OnWindowDestroyed(ServerWindow* window) override;
125 137
126 WindowTreeHostDelegate* delegate_; 138 WindowTreeHostDelegate* delegate_;
127 ConnectionManager* const connection_manager_; 139 ConnectionManager* const connection_manager_;
128 mojom::WindowTreeHostClientPtr client_; 140 mojom::WindowTreeHostClientPtr client_;
129 EventDispatcher event_dispatcher_; 141 EventDispatcher event_dispatcher_;
130 scoped_ptr<ServerWindow> root_; 142 scoped_ptr<ServerWindow> root_;
131 scoped_ptr<DisplayManager> display_manager_; 143 scoped_ptr<DisplayManager> display_manager_;
132 scoped_ptr<FocusController> focus_controller_; 144 scoped_ptr<FocusController> focus_controller_;
133 mojom::WindowManagerPtr window_manager_; 145 mojom::WindowManagerPtr window_manager_;
134 146
135 // Set of windows with surfaces that need to be destroyed once the frame 147 // Set of windows with surfaces that need to be destroyed once the frame
136 // draws. 148 // draws.
137 std::set<ServerWindow*> windows_needing_frame_destruction_; 149 std::set<ServerWindow*> windows_needing_frame_destruction_;
138 150
139 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl); 151 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostImpl);
140 }; 152 };
141 153
142 } // namespace ws 154 } // namespace ws
143 } // namespace mus 155 } // namespace mus
144 156
145 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_ 157 #endif // COMPONENTS_MUS_WS_WINDOW_TREE_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698