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

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

Issue 2456623002: Fixes to WindowTreeHostMus (Closed)
Patch Set: merge 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/mus_types.h ('k') | ui/aura/mus/window_port_mus.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_MUS_H_ 5 #ifndef UI_AURA_MUS_WINDOW_MUS_H_
6 #define UI_AURA_MUS_WINDOW_MUS_H_ 6 #define UI_AURA_MUS_WINDOW_MUS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "services/ui/public/interfaces/cursor.mojom.h" 13 #include "services/ui/public/interfaces/cursor.mojom.h"
14 #include "ui/aura/aura_export.h" 14 #include "ui/aura/aura_export.h"
15 #include "ui/aura/mus/mus_types.h" 15 #include "ui/aura/mus/mus_types.h"
16 16
17 namespace gfx { 17 namespace gfx {
18 class Rect; 18 class Rect;
19 class Vector2d;
19 } 20 }
20 21
21 namespace ui { 22 namespace ui {
22 namespace mojom { 23 namespace mojom {
23 enum class OrderDirection; 24 enum class OrderDirection;
24 } 25 }
25 } 26 }
26 27
27 namespace aura { 28 namespace aura {
28 29
29 struct SurfaceInfo; 30 struct SurfaceInfo;
30 class Window; 31 class Window;
31 class WindowTreeClient; 32 class WindowTreeClient;
32 33
34 // See PrepareForServerBoundsChange() for details on this.
35 struct AURA_EXPORT WindowMusChangeData {
36 virtual ~WindowMusChangeData() {}
37 };
38
33 // WindowMus defines the interface used by WindowTreeClient to modify 39 // WindowMus defines the interface used by WindowTreeClient to modify
34 // the underlying Window. It's defined as a separate interface to make it clear 40 // the underlying Window. It's defined as a separate interface to make it clear
35 // that any changes that WindowTreeClient makes must be propagated through 41 // that any changes that WindowTreeClient makes must be propagated through
36 // this interface so that they don't result in bouncing back to 42 // this interface so that they don't result in bouncing back to
37 // WindowTreeClient. For example, if the server change the bounds care must be 43 // WindowTreeClient. For example, if the server change the bounds care must be
38 // taken that when the change is applied to the Window the server isn't asked to 44 // taken that when the change is applied to the Window the server isn't asked to
39 // change the bounds too. See WindowPortMus for details. 45 // change the bounds too. See WindowPortMus for details.
40 class AURA_EXPORT WindowMus { 46 class AURA_EXPORT WindowMus {
41 public: 47 public:
48 // |create_remote_window| indicates whether a window should be created on the
49 // server. Generally |create_remote_window| should be true, only in rare
50 // exceptions (such as the root of a WindowTreeHost) is it false.
51 explicit WindowMus(bool create_remote_window)
52 : create_remote_window_(create_remote_window) {}
42 virtual ~WindowMus() {} 53 virtual ~WindowMus() {}
43 54
44 // Returns the WindowMus associated with |window|. 55 // Returns the WindowMus associated with |window|.
45 static WindowMus* Get(Window* window); 56 static WindowMus* Get(Window* window);
46 57
47 Id server_id() const { return server_id_; } 58 Id server_id() const { return server_id_; }
48 59
49 // Top level windows may have a root window with no associated server window. 60 // Top level windows may have a root window with no associated server window.
50 // This happens because the client creates the top level window first, and 61 // This happens because the client creates the top level window first, and
51 // then the WindowTreeHost. Each WindowTreeHost has a Window, so the 62 // then the WindowTreeHost. Each WindowTreeHost has a Window, so the
52 // WindowTreeHost for top-levels has no server window. 63 // WindowTreeHost for top-levels has no server window.
53 bool has_server_window() const { return server_id() != kInvalidServerId; } 64 bool has_server_window() const { return server_id() != kInvalidServerId; }
54 65
66 // See constructor for details.
67 bool create_remote_window() const { return create_remote_window_; }
68
55 virtual Window* GetWindow() = 0; 69 virtual Window* GetWindow() = 0;
56 70
57 // These functions are called in response to a change from the server. The 71 // These functions are called in response to a change from the server. The
58 // expectation is that in calling these WindowTreeClient is not called 72 // expectation is that in calling these WindowTreeClient is not called
59 // back. For example, SetBoundsFromServer() should not result in calling back 73 // back. For example, SetBoundsFromServer() should not result in calling back
60 // to WindowTreeClient::OnWindowMusBoundsChanged(). 74 // to WindowTreeClient::OnWindowMusBoundsChanged().
61 virtual void AddChildFromServer(WindowMus* window) = 0; 75 virtual void AddChildFromServer(WindowMus* window) = 0;
62 virtual void RemoveChildFromServer(WindowMus* child) = 0; 76 virtual void RemoveChildFromServer(WindowMus* child) = 0;
63 virtual void ReorderFromServer(WindowMus* child, 77 virtual void ReorderFromServer(WindowMus* child,
64 WindowMus* relative, 78 WindowMus* relative,
65 ui::mojom::OrderDirection) = 0; 79 ui::mojom::OrderDirection) = 0;
66 virtual void SetBoundsFromServer(const gfx::Rect& bounds) = 0; 80 virtual void SetBoundsFromServer(const gfx::Rect& bounds) = 0;
67 virtual void SetVisibleFromServer(bool visible) = 0; 81 virtual void SetVisibleFromServer(bool visible) = 0;
68 virtual void SetOpacityFromServer(float opacity) = 0; 82 virtual void SetOpacityFromServer(float opacity) = 0;
69 virtual void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) = 0; 83 virtual void SetPredefinedCursorFromServer(ui::mojom::Cursor cursor) = 0;
70 virtual void SetPropertyFromServer(const std::string& property_name, 84 virtual void SetPropertyFromServer(const std::string& property_name,
71 const std::vector<uint8_t>* data) = 0; 85 const std::vector<uint8_t>* data) = 0;
72 virtual void SetSurfaceIdFromServer( 86 virtual void SetSurfaceIdFromServer(
73 std::unique_ptr<SurfaceInfo> surface_info) = 0; 87 std::unique_ptr<SurfaceInfo> surface_info) = 0;
74 88
89 // Called in the rare case when WindowTreeClient needs to change state and
90 // can't go through one of the SetFooFromServer() functions above. Generally
91 // because it needs to call another function that as a side effect changes the
92 // window. Once the call to the underlying window has completed the returned
93 // object should be destroyed.
94 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerBoundsChange(
95 const gfx::Rect& bounds) = 0;
96 virtual std::unique_ptr<WindowMusChangeData> PrepareForServerVisibilityChange(
97 bool value) = 0;
98
75 virtual void NotifyEmbeddedAppDisconnected() = 0; 99 virtual void NotifyEmbeddedAppDisconnected() = 0;
76 100
77 private: 101 private:
78 // Just for set_server_id(), which other places should not call. 102 // Just for set_server_id(), which other places should not call.
79 friend class WindowTreeClient; 103 friend class WindowTreeClient;
80 104
81 void set_server_id(Id id) { server_id_ = id; } 105 void set_server_id(Id id) { server_id_ = id; }
82 106
83 Id server_id_ = kInvalidServerId; 107 Id server_id_ = kInvalidServerId;
108 const bool create_remote_window_;
84 }; 109 };
85 110
86 } // namespace aura 111 } // namespace aura
87 112
88 #endif // UI_AURA_MUS_WINDOW_MUS_H_ 113 #endif // UI_AURA_MUS_WINDOW_MUS_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/mus_types.h ('k') | ui/aura/mus/window_port_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698