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

Side by Side Diff: ui/aura/mus/window_tree_client.h

Issue 2470963002: Makes it possible for clients to directly create WindowTreeHostMus (Closed)
Patch Set: nuke comment Created 4 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
« no previous file with comments | « ui/aura/mus/window_port_mus.cc ('k') | ui/aura/mus/window_tree_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ 5 #ifndef UI_AURA_MUS_WINDOW_TREE_CLIENT_H_
6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ 6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 class InFlightPropertyChange; 51 class InFlightPropertyChange;
52 class InFlightVisibleChange; 52 class InFlightVisibleChange;
53 class WindowMus; 53 class WindowMus;
54 class WindowPortMus; 54 class WindowPortMus;
55 struct WindowPortInitData; 55 struct WindowPortInitData;
56 struct WindowPortPropertyData; 56 struct WindowPortPropertyData;
57 class WindowTreeClientDelegate; 57 class WindowTreeClientDelegate;
58 class WindowTreeClientPrivate; 58 class WindowTreeClientPrivate;
59 class WindowTreeClientObserver; 59 class WindowTreeClientObserver;
60 class WindowTreeHost; 60 class WindowTreeHost;
61 class WindowTreeHostMus;
61 62
62 namespace client { 63 namespace client {
63 class FocusClient; 64 class FocusClient;
64 } 65 }
65 66
66 using EventResultCallback = base::Callback<void(ui::mojom::EventResult)>; 67 using EventResultCallback = base::Callback<void(ui::mojom::EventResult)>;
67 68
68 // Manages the connection with mus. 69 // Manages the connection with mus.
69 // 70 //
70 // WindowTreeClient is owned by the creator. Generally when the delegate gets 71 // WindowTreeClient is owned by the creator. Generally when the delegate gets
(...skipping 17 matching lines...) Expand all
88 WindowManagerDelegate* window_manager_delegate = nullptr, 89 WindowManagerDelegate* window_manager_delegate = nullptr,
89 ui::mojom::WindowTreeClientRequest request = nullptr); 90 ui::mojom::WindowTreeClientRequest request = nullptr);
90 ~WindowTreeClient() override; 91 ~WindowTreeClient() override;
91 92
92 // Establishes the connection by way of the WindowTreeFactory. 93 // Establishes the connection by way of the WindowTreeFactory.
93 void ConnectViaWindowTreeFactory(service_manager::Connector* connector); 94 void ConnectViaWindowTreeFactory(service_manager::Connector* connector);
94 95
95 // Establishes the connection by way of WindowManagerWindowTreeFactory. 96 // Establishes the connection by way of WindowManagerWindowTreeFactory.
96 void ConnectAsWindowManager(service_manager::Connector* connector); 97 void ConnectAsWindowManager(service_manager::Connector* connector);
97 98
98 // Wait for OnEmbed(), returning when done.
99 void WaitForEmbed();
100
101 bool connected() const { return tree_ != nullptr; } 99 bool connected() const { return tree_ != nullptr; }
102 ClientSpecificId client_id() const { return client_id_; } 100 ClientSpecificId client_id() const { return client_id_; }
103 101
104 void SetClientArea(Window* window, 102 void SetClientArea(Window* window,
105 const gfx::Insets& client_area, 103 const gfx::Insets& client_area,
106 const std::vector<gfx::Rect>& additional_client_areas); 104 const std::vector<gfx::Rect>& additional_client_areas);
107 void SetHitTestMask(Window* window, const gfx::Rect& mask); 105 void SetHitTestMask(Window* window, const gfx::Rect& mask);
108 void ClearHitTestMask(Window* window); 106 void ClearHitTestMask(Window* window);
109 void SetCanFocus(Window* window, bool can_focus); 107 void SetCanFocus(Window* window, bool can_focus);
110 void SetCanAcceptDrops(Id window_id, bool can_accept_drops); 108 void SetCanAcceptDrops(Id window_id, bool can_accept_drops);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 // Returns true if there is an InFlightChange that matches |change|. If there 197 // Returns true if there is an InFlightChange that matches |change|. If there
200 // is an existing change SetRevertValueFrom() is invoked on it. Returns false 198 // is an existing change SetRevertValueFrom() is invoked on it. Returns false
201 // if there is no InFlightChange matching |change|. 199 // if there is no InFlightChange matching |change|.
202 // See InFlightChange for details on how InFlightChanges are used. 200 // See InFlightChange for details on how InFlightChanges are used.
203 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); 201 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change);
204 202
205 void BuildWindowTree(const mojo::Array<ui::mojom::WindowDataPtr>& windows, 203 void BuildWindowTree(const mojo::Array<ui::mojom::WindowDataPtr>& windows,
206 WindowMus* initial_parent); 204 WindowMus* initial_parent);
207 205
208 // Creates a WindowPortMus from the server side data. 206 // Creates a WindowPortMus from the server side data.
209 // NOTE: this *must* be followed by SetLocalPropertiesFromServerProperties()
210 std::unique_ptr<WindowPortMus> CreateWindowPortMus( 207 std::unique_ptr<WindowPortMus> CreateWindowPortMus(
211 const ui::mojom::WindowDataPtr& window_data); 208 const ui::mojom::WindowDataPtr& window_data,
209 WindowMusType window_mus_type);
212 210
213 // Sets local properties on the associated Window from the server properties. 211 // Sets local properties on the associated Window from the server properties.
214 void SetLocalPropertiesFromServerProperties( 212 void SetLocalPropertiesFromServerProperties(
215 WindowMus* window, 213 WindowMus* window,
216 const ui::mojom::WindowDataPtr& window_data); 214 const ui::mojom::WindowDataPtr& window_data);
217 215
218 // Creates a WindowTreeHostMus and returns the window associated with it. 216 // Creates a new WindowTreeHostMus.
219 // The returned window is either the content window of the WindowTreeHostMus 217 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost(
220 // or the window created by WindowTreeHost. See WindowTreeHostMus for 218 WindowMusType window_mus_type,
221 // details. 219 const ui::mojom::WindowDataPtr& window_data,
222 // TODO(sky): it would be nice to always have a single window and not the 220 int64_t display_id);
223 // two different. That requires ownership changes to WindowTreeHost though.
224 Window* CreateWindowTreeHost(RootWindowType type,
225 const ui::mojom::WindowDataPtr& window_data,
226 int64_t display_id,
227 Window* content_window);
228 221
229 WindowMus* NewWindowFromWindowData( 222 WindowMus* NewWindowFromWindowData(
230 WindowMus* parent, 223 WindowMus* parent,
231 const ui::mojom::WindowDataPtr& window_data); 224 const ui::mojom::WindowDataPtr& window_data);
232 225
233 // Sets the ui::mojom::WindowTree implementation. 226 // Sets the ui::mojom::WindowTree implementation.
234 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); 227 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr);
235 228
236 // Called when the connection to the server is established. 229 // Called when the connection to the server is established.
237 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); 230 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree);
(...skipping 22 matching lines...) Expand all
260 int32_t event_id); 253 int32_t event_id);
261 254
262 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle); 255 void OnReceivedCursorLocationMemory(mojo::ScopedSharedBufferHandle handle);
263 256
264 // Called when a property needs to change as the result of a change in the 257 // Called when a property needs to change as the result of a change in the
265 // server, or the server failing to accept a change. 258 // server, or the server failing to accept a change.
266 void SetWindowBoundsFromServer(WindowMus* window, 259 void SetWindowBoundsFromServer(WindowMus* window,
267 const gfx::Rect& revert_bounds); 260 const gfx::Rect& revert_bounds);
268 void SetWindowVisibleFromServer(WindowMus* window, bool visible); 261 void SetWindowVisibleFromServer(WindowMus* window, bool visible);
269 262
263 // Called from OnWindowMusBoundsChanged() and SetRootWindowBounds().
264 void ScheduleInFlightBoundsChange(WindowMus* window,
265 const gfx::Rect& old_bounds,
266 const gfx::Rect& new_bounds);
267
270 // Following are called from WindowMus. 268 // Following are called from WindowMus.
271 std::unique_ptr<WindowPortInitData> OnWindowMusCreated(WindowMus* window); 269 void OnWindowMusCreated(WindowMus* window);
272 void OnWindowMusInitDone(WindowMus* window,
273 std::unique_ptr<WindowPortInitData> init_data);
274 void OnWindowMusDestroyed(WindowMus* window); 270 void OnWindowMusDestroyed(WindowMus* window);
275 void OnWindowMusBoundsChanged(WindowMus* window, 271 void OnWindowMusBoundsChanged(WindowMus* window,
276 const gfx::Rect& old_bounds, 272 const gfx::Rect& old_bounds,
277 const gfx::Rect& new_bounds); 273 const gfx::Rect& new_bounds);
278 void OnWindowMusAddChild(WindowMus* parent, WindowMus* child); 274 void OnWindowMusAddChild(WindowMus* parent, WindowMus* child);
279 void OnWindowMusRemoveChild(WindowMus* parent, WindowMus* child); 275 void OnWindowMusRemoveChild(WindowMus* parent, WindowMus* child);
280 void OnWindowMusMoveChild(WindowMus* parent, 276 void OnWindowMusMoveChild(WindowMus* parent,
281 size_t current_index, 277 size_t current_index,
282 size_t dest_index); 278 size_t dest_index);
283 void OnWindowMusSetVisible(WindowMus* window, bool visible); 279 void OnWindowMusSetVisible(WindowMus* window, bool visible);
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 void ActivateNextWindow() override; 416 void ActivateNextWindow() override;
421 void SetUnderlaySurfaceOffsetAndExtendedHitArea( 417 void SetUnderlaySurfaceOffsetAndExtendedHitArea(
422 Window* window, 418 Window* window,
423 const gfx::Vector2d& offset, 419 const gfx::Vector2d& offset,
424 const gfx::Insets& hit_area) override; 420 const gfx::Insets& hit_area) override;
425 421
426 // Overriden from client::FocusChangeObserver: 422 // Overriden from client::FocusChangeObserver:
427 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override; 423 void OnWindowFocused(Window* gained_focus, Window* lost_focus) override;
428 424
429 // Overriden from WindowTreeHostMusDelegate: 425 // Overriden from WindowTreeHostMusDelegate:
430 void SetRootWindowBounds(Window* window, gfx::Rect* bounds) override; 426 void OnWindowTreeHostBoundsWillChange(WindowTreeHostMus* window_tree_host,
427 const gfx::Rect& bounds) override;
428 std::unique_ptr<WindowPortMus> CreateWindowPortForTopLevel() override;
429 void OnWindowTreeHostCreated(WindowTreeHostMus* window_tree_host) override;
431 430
432 // Override from client::TransientWindowClientObserver: 431 // Override from client::TransientWindowClientObserver:
433 void OnTransientChildWindowAdded(Window* parent, 432 void OnTransientChildWindowAdded(Window* parent,
434 Window* transient_child) override; 433 Window* transient_child) override;
435 void OnTransientChildWindowRemoved(Window* parent, 434 void OnTransientChildWindowRemoved(Window* parent,
436 Window* transient_child) override; 435 Window* transient_child) override;
437 436
438 // Overriden from DragDropControllerHost: 437 // Overriden from DragDropControllerHost:
439 uint32_t CreateChangeIdForDrag(WindowMus* window) override; 438 uint32_t CreateChangeIdForDrag(WindowMus* window) override;
440 439
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 std::unique_ptr<DragDropControllerMus> drag_drop_controller_; 510 std::unique_ptr<DragDropControllerMus> drag_drop_controller_;
512 511
513 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 512 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
514 513
515 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 514 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
516 }; 515 };
517 516
518 } // namespace aura 517 } // namespace aura
519 518
520 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ 519 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/window_port_mus.cc ('k') | ui/aura/mus/window_tree_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698