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

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

Issue 2582823002: WIP: Surface Synchronization System
Patch Set: Only create ClientSurfaceEmbedder if window is visible. Trash it otherwise. Created 3 years, 10 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>
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // parent and the window is deleted the deleted window is implicitly removed 44 // parent and the window is deleted the deleted window is implicitly removed
45 // from the parent. 45 // from the parent.
46 class ServerWindow { 46 class ServerWindow {
47 public: 47 public:
48 using Properties = std::map<std::string, std::vector<uint8_t>>; 48 using Properties = std::map<std::string, std::vector<uint8_t>>;
49 using Windows = std::vector<ServerWindow*>; 49 using Windows = std::vector<ServerWindow*>;
50 50
51 ServerWindow(ServerWindowDelegate* delegate, const WindowId& id); 51 ServerWindow(ServerWindowDelegate* delegate, const WindowId& id);
52 ServerWindow(ServerWindowDelegate* delegate, 52 ServerWindow(ServerWindowDelegate* delegate,
53 const WindowId& id, 53 const WindowId& id,
54 const Properties& properties); 54 const Properties& properties,
55 const cc::LocalFrameId& local_frame_id);
55 ~ServerWindow(); 56 ~ServerWindow();
56 57
57 void AddObserver(ServerWindowObserver* observer); 58 void AddObserver(ServerWindowObserver* observer);
58 void RemoveObserver(ServerWindowObserver* observer); 59 void RemoveObserver(ServerWindowObserver* observer);
59 bool HasObserver(ServerWindowObserver* observer); 60 bool HasObserver(ServerWindowObserver* observer);
60 61
61 // Creates a new CompositorFrameSink of the specified type, replacing the 62 // Creates a new CompositorFrameSink of the specified type, replacing the
62 // existing. 63 // existing.
63 void CreateDisplayCompositorFrameSink( 64 void CreateDisplayCompositorFrameSink(
64 gfx::AcceleratedWidget widget, 65 gfx::AcceleratedWidget widget,
65 cc::mojom::MojoCompositorFrameSinkAssociatedRequest sink_request, 66 cc::mojom::MojoCompositorFrameSinkAssociatedRequest sink_request,
66 cc::mojom::MojoCompositorFrameSinkClientPtr client, 67 cc::mojom::MojoCompositorFrameSinkClientPtr client,
67 cc::mojom::DisplayPrivateAssociatedRequest display_request); 68 cc::mojom::DisplayPrivateAssociatedRequest display_request);
68 69
69 void CreateOffscreenCompositorFrameSink( 70 void CreateOffscreenCompositorFrameSink(
70 cc::mojom::MojoCompositorFrameSinkRequest request, 71 cc::mojom::MojoCompositorFrameSinkRequest request,
71 cc::mojom::MojoCompositorFrameSinkClientPtr client); 72 cc::mojom::MojoCompositorFrameSinkClientPtr client);
72 73
73 const WindowId& id() const { return id_; } 74 const WindowId& id() const { return id_; }
74 75
75 void Add(ServerWindow* child); 76 void Add(ServerWindow* child);
76 void Remove(ServerWindow* child); 77 void Remove(ServerWindow* child);
77 void Reorder(ServerWindow* relative, mojom::OrderDirection diretion); 78 void Reorder(ServerWindow* relative, mojom::OrderDirection diretion);
78 void StackChildAtBottom(ServerWindow* child); 79 void StackChildAtBottom(ServerWindow* child);
79 void StackChildAtTop(ServerWindow* child); 80 void StackChildAtTop(ServerWindow* child);
80 81
81 const gfx::Rect& bounds() const { return bounds_; } 82 const gfx::Rect& bounds() const { return bounds_; }
82 // Sets the bounds. If the size changes this implicitly resets the client 83 // Sets the bounds. If the size changes this implicitly resets the client
83 // area to fill the whole bounds. 84 // area to fill the whole bounds.
84 void SetBounds(const gfx::Rect& bounds); 85 void SetBounds(const gfx::Rect& bounds,
86 const cc::LocalFrameId& local_frame_id);
85 87
86 const std::vector<gfx::Rect>& additional_client_areas() const { 88 const std::vector<gfx::Rect>& additional_client_areas() const {
87 return additional_client_areas_; 89 return additional_client_areas_;
88 } 90 }
89 const gfx::Insets& client_area() const { return client_area_; } 91 const gfx::Insets& client_area() const { return client_area_; }
90 void SetClientArea(const gfx::Insets& insets, 92 void SetClientArea(const gfx::Insets& insets,
91 const std::vector<gfx::Rect>& additional_client_areas); 93 const std::vector<gfx::Rect>& additional_client_areas);
92 94
93 const gfx::Rect* hit_test_mask() const { return hit_test_mask_.get(); } 95 const gfx::Rect* hit_test_mask() const { return hit_test_mask_.get(); }
94 void SetHitTestMask(const gfx::Rect& mask); 96 void SetHitTestMask(const gfx::Rect& mask);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const ui::TextInputState& text_input_state() const { 162 const ui::TextInputState& text_input_state() const {
161 return text_input_state_; 163 return text_input_state_;
162 } 164 }
163 165
164 void set_can_focus(bool can_focus) { can_focus_ = can_focus; } 166 void set_can_focus(bool can_focus) { can_focus_ = can_focus; }
165 bool can_focus() const { return can_focus_; } 167 bool can_focus() const { return can_focus_; }
166 168
167 void set_can_accept_events(bool value) { can_accept_events_ = value; } 169 void set_can_accept_events(bool value) { can_accept_events_ = value; }
168 bool can_accept_events() const { return can_accept_events_; } 170 bool can_accept_events() const { return can_accept_events_; }
169 171
172 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; }
173
170 // Returns true if this window is attached to a root and all ancestors are 174 // Returns true if this window is attached to a root and all ancestors are
171 // visible. 175 // visible.
172 bool IsDrawn() const; 176 bool IsDrawn() const;
173 177
174 const gfx::Insets& extended_hit_test_region() const { 178 const gfx::Insets& extended_hit_test_region() const {
175 return extended_hit_test_region_; 179 return extended_hit_test_region_;
176 } 180 }
177 void set_extended_hit_test_region(const gfx::Insets& insets) { 181 void set_extended_hit_test_region(const gfx::Insets& insets) {
178 extended_hit_test_region_ = insets; 182 extended_hit_test_region_ = insets;
179 } 183 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 static void ReorderImpl(ServerWindow* window, 221 static void ReorderImpl(ServerWindow* window,
218 ServerWindow* relative, 222 ServerWindow* relative,
219 mojom::OrderDirection diretion); 223 mojom::OrderDirection diretion);
220 224
221 // Returns a pointer to the stacking target that can be used by 225 // Returns a pointer to the stacking target that can be used by
222 // RestackTransientDescendants. 226 // RestackTransientDescendants.
223 static ServerWindow** GetStackingTarget(ServerWindow* window); 227 static ServerWindow** GetStackingTarget(ServerWindow* window);
224 228
225 ServerWindowDelegate* delegate_; 229 ServerWindowDelegate* delegate_;
226 const WindowId id_; 230 const WindowId id_;
231 cc::LocalFrameId local_frame_id_;
227 ServerWindow* parent_; 232 ServerWindow* parent_;
228 Windows children_; 233 Windows children_;
229 234
230 // Transient window management. 235 // Transient window management.
231 // If non-null we're actively restacking transient as the result of a 236 // If non-null we're actively restacking transient as the result of a
232 // transient ancestor changing. 237 // transient ancestor changing.
233 ServerWindow* stacking_target_; 238 ServerWindow* stacking_target_;
234 ServerWindow* transient_parent_; 239 ServerWindow* transient_parent_;
235 Windows transient_children_; 240 Windows transient_children_;
236 241
(...skipping 30 matching lines...) Expand all
267 272
268 base::ObserverList<ServerWindowObserver> observers_; 273 base::ObserverList<ServerWindowObserver> observers_;
269 274
270 DISALLOW_COPY_AND_ASSIGN(ServerWindow); 275 DISALLOW_COPY_AND_ASSIGN(ServerWindow);
271 }; 276 };
272 277
273 } // namespace ws 278 } // namespace ws
274 } // namespace ui 279 } // namespace ui
275 280
276 #endif // SERVICES_UI_WS_SERVER_WINDOW_H_ 281 #endif // SERVICES_UI_WS_SERVER_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698