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

Side by Side Diff: services/ui/ws/server_window.h

Issue 2429173005: Mus+Ash: Replace (Server)WindowSurface with (Server)WindowCompositorFrameSink (Closed)
Patch Set: ui::CompositorFrameSink => ui::WindowCompositorFrameSink Created 4 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 SERVICES_UI_WS_SERVER_WINDOW_H_ 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_H_
6 #define SERVICES_UI_WS_SERVER_WINDOW_H_ 6 #define SERVICES_UI_WS_SERVER_WINDOW_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "mojo/public/cpp/bindings/binding.h" 17 #include "mojo/public/cpp/bindings/binding.h"
18 #include "services/ui/public/interfaces/window_tree.mojom.h" 18 #include "services/ui/public/interfaces/window_tree.mojom.h"
19 #include "services/ui/ws/ids.h" 19 #include "services/ui/ws/ids.h"
20 #include "services/ui/ws/server_window_surface.h" 20 #include "services/ui/ws/server_window_compositor_frame_sink.h"
21 #include "ui/gfx/geometry/insets.h" 21 #include "ui/gfx/geometry/insets.h"
22 #include "ui/gfx/geometry/rect.h" 22 #include "ui/gfx/geometry/rect.h"
23 #include "ui/gfx/geometry/vector2d.h" 23 #include "ui/gfx/geometry/vector2d.h"
24 #include "ui/gfx/transform.h" 24 #include "ui/gfx/transform.h"
25 #include "ui/platform_window/text_input_state.h" 25 #include "ui/platform_window/text_input_state.h"
26 26
27 namespace ui { 27 namespace ui {
28 namespace ws { 28 namespace ws {
29 29
30 class ServerWindowDelegate; 30 class ServerWindowDelegate;
31 class ServerWindowObserver; 31 class ServerWindowObserver;
32 class ServerWindowSurfaceManager; 32 class ServerWindowCompositorFrameSinkManager;
33 33
34 // Server side representation of a window. Delegate is informed of interesting 34 // Server side representation of a window. Delegate is informed of interesting
35 // events. 35 // events.
36 // 36 //
37 // It is assumed that all functions that mutate the tree have validated the 37 // It is assumed that all functions that mutate the tree have validated the
38 // mutation is possible before hand. For example, Reorder() assumes the supplied 38 // mutation is possible before hand. For example, Reorder() assumes the supplied
39 // window is a child and not already in position. 39 // window is a child and not already in position.
40 // 40 //
41 // ServerWindows do not own their children. If you delete a window that has 41 // ServerWindows do not own their children. If you delete a window that has
42 // children the children are implicitly removed. Similarly if a window has a 42 // children the children are implicitly removed. Similarly if a window has a
43 // parent and the window is deleted the deleted window is implicitly removed 43 // parent and the window is deleted the deleted window is implicitly removed
44 // from the parent. 44 // from the parent.
45 class ServerWindow { 45 class ServerWindow {
46 public: 46 public:
47 using Properties = std::map<std::string, std::vector<uint8_t>>; 47 using Properties = std::map<std::string, std::vector<uint8_t>>;
48 using Windows = std::vector<ServerWindow*>; 48 using Windows = std::vector<ServerWindow*>;
49 49
50 ServerWindow(ServerWindowDelegate* delegate, const WindowId& id); 50 ServerWindow(ServerWindowDelegate* delegate, const WindowId& id);
51 ServerWindow(ServerWindowDelegate* delegate, 51 ServerWindow(ServerWindowDelegate* delegate,
52 const WindowId& id, 52 const WindowId& id,
53 const Properties& properties); 53 const Properties& properties);
54 ~ServerWindow(); 54 ~ServerWindow();
55 55
56 void AddObserver(ServerWindowObserver* observer); 56 void AddObserver(ServerWindowObserver* observer);
57 void RemoveObserver(ServerWindowObserver* observer); 57 void RemoveObserver(ServerWindowObserver* observer);
58 bool HasObserver(ServerWindowObserver* observer); 58 bool HasObserver(ServerWindowObserver* observer);
59 59
60 // Creates a new surface of the specified type, replacing the existing. 60 // Creates a new surface of the specified type, replacing the existing.
61 void CreateSurface( 61 void CreateCompositorFrameSink(
62 mojom::SurfaceType surface_type, 62 mojom::CompositorFrameSinkType compositor_frame_sink_type,
63 mojo::InterfaceRequest<cc::mojom::MojoCompositorFrameSink> request, 63 cc::mojom::MojoCompositorFrameSinkRequest request,
64 cc::mojom::MojoCompositorFrameSinkClientPtr client); 64 cc::mojom::MojoCompositorFrameSinkClientPtr client);
65 65
66 const WindowId& id() const { return id_; } 66 const WindowId& id() const { return id_; }
67 67
68 void Add(ServerWindow* child); 68 void Add(ServerWindow* child);
69 void Remove(ServerWindow* child); 69 void Remove(ServerWindow* child);
70 void Reorder(ServerWindow* relative, mojom::OrderDirection diretion); 70 void Reorder(ServerWindow* relative, mojom::OrderDirection diretion);
71 void StackChildAtBottom(ServerWindow* child); 71 void StackChildAtBottom(ServerWindow* child);
72 void StackChildAtTop(ServerWindow* child); 72 void StackChildAtTop(ServerWindow* child);
73 73
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // visible. 162 // visible.
163 bool IsDrawn() const; 163 bool IsDrawn() const;
164 164
165 const gfx::Insets& extended_hit_test_region() const { 165 const gfx::Insets& extended_hit_test_region() const {
166 return extended_hit_test_region_; 166 return extended_hit_test_region_;
167 } 167 }
168 void set_extended_hit_test_region(const gfx::Insets& insets) { 168 void set_extended_hit_test_region(const gfx::Insets& insets) {
169 extended_hit_test_region_ = insets; 169 extended_hit_test_region_ = insets;
170 } 170 }
171 171
172 ServerWindowSurfaceManager* GetOrCreateSurfaceManager(); 172 ServerWindowCompositorFrameSinkManager*
173 ServerWindowSurfaceManager* surface_manager() { 173 GetOrCreateCompositorFrameSinkManager();
174 return surface_manager_.get(); 174 ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager() {
175 return compositor_frame_sink_manager_.get();
175 } 176 }
176 const ServerWindowSurfaceManager* surface_manager() const { 177 const ServerWindowCompositorFrameSinkManager* compositor_frame_sink_manager()
177 return surface_manager_.get(); 178 const {
179 return compositor_frame_sink_manager_.get();
178 } 180 }
179 181
180 // Offset of the underlay from the the window bounds (used for shadows). 182 // Offset of the underlay from the the window bounds (used for shadows).
181 const gfx::Vector2d& underlay_offset() const { return underlay_offset_; } 183 const gfx::Vector2d& underlay_offset() const { return underlay_offset_; }
182 void SetUnderlayOffset(const gfx::Vector2d& offset); 184 void SetUnderlayOffset(const gfx::Vector2d& offset);
183 185
184 ServerWindowDelegate* delegate() { return delegate_; } 186 ServerWindowDelegate* delegate() { return delegate_; }
185 187
186 // Called when the window is no longer an embed root. 188 // Called when the window is no longer an embed root.
187 void OnEmbeddedAppDisconnected(); 189 void OnEmbeddedAppDisconnected();
(...skipping 29 matching lines...) Expand all
217 // transient ancestor changing. 219 // transient ancestor changing.
218 ServerWindow* stacking_target_; 220 ServerWindow* stacking_target_;
219 ServerWindow* transient_parent_; 221 ServerWindow* transient_parent_;
220 Windows transient_children_; 222 Windows transient_children_;
221 223
222 bool is_modal_; 224 bool is_modal_;
223 bool visible_; 225 bool visible_;
224 gfx::Rect bounds_; 226 gfx::Rect bounds_;
225 gfx::Insets client_area_; 227 gfx::Insets client_area_;
226 std::vector<gfx::Rect> additional_client_areas_; 228 std::vector<gfx::Rect> additional_client_areas_;
227 std::unique_ptr<ServerWindowSurfaceManager> surface_manager_; 229 std::unique_ptr<ServerWindowCompositorFrameSinkManager>
230 compositor_frame_sink_manager_;
228 mojom::Cursor cursor_id_; 231 mojom::Cursor cursor_id_;
229 mojom::Cursor non_client_cursor_id_; 232 mojom::Cursor non_client_cursor_id_;
230 float opacity_; 233 float opacity_;
231 bool can_focus_; 234 bool can_focus_;
232 bool can_accept_events_; 235 bool can_accept_events_;
233 gfx::Transform transform_; 236 gfx::Transform transform_;
234 ui::TextInputState text_input_state_; 237 ui::TextInputState text_input_state_;
235 238
236 Properties properties_; 239 Properties properties_;
237 240
(...skipping 13 matching lines...) Expand all
251 254
252 base::ObserverList<ServerWindowObserver> observers_; 255 base::ObserverList<ServerWindowObserver> observers_;
253 256
254 DISALLOW_COPY_AND_ASSIGN(ServerWindow); 257 DISALLOW_COPY_AND_ASSIGN(ServerWindow);
255 }; 258 };
256 259
257 } // namespace ws 260 } // namespace ws
258 } // namespace ui 261 } // namespace ui
259 262
260 #endif // SERVICES_UI_WS_SERVER_WINDOW_H_ 263 #endif // SERVICES_UI_WS_SERVER_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698