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

Side by Side Diff: ui/aura/mus/window_mus.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_manager_delegate.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>
(...skipping 27 matching lines...) Expand all
38 38
39 // WindowMus defines the interface used by WindowTreeClient to modify 39 // WindowMus defines the interface used by WindowTreeClient to modify
40 // 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
41 // that any changes that WindowTreeClient makes must be propagated through 41 // that any changes that WindowTreeClient makes must be propagated through
42 // 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
43 // 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
44 // 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
45 // change the bounds too. See WindowPortMus for details. 45 // change the bounds too. See WindowPortMus for details.
46 class AURA_EXPORT WindowMus { 46 class AURA_EXPORT WindowMus {
47 public: 47 public:
48
49 enum class ChangeSource { 48 enum class ChangeSource {
50 // The change was made locally. 49 // The change was made locally.
51 LOCAL, 50 LOCAL,
52 // The change originated from the server. 51 // The change originated from the server.
53 SERVER, 52 SERVER,
54 }; 53 };
55 54
56 // |create_remote_window| indicates whether a window should be created on the 55 explicit WindowMus(WindowMusType window_mus_type)
57 // server. Generally |create_remote_window| should be true, only in rare 56 : window_mus_type_(window_mus_type) {}
58 // exceptions (such as the root of a WindowTreeHost) is it false.
59 explicit WindowMus(bool create_remote_window)
60 : create_remote_window_(create_remote_window) {}
61 virtual ~WindowMus() {} 57 virtual ~WindowMus() {}
62 58
63 // Returns the WindowMus associated with |window|. 59 // Returns the WindowMus associated with |window|.
64 static WindowMus* Get(Window* window); 60 static WindowMus* Get(Window* window);
65 61
66 Id server_id() const { return server_id_; } 62 Id server_id() const { return server_id_; }
67 63
68 // Top level windows may have a root window with no associated server window. 64 WindowMusType window_mus_type() const { return window_mus_type_; }
69 // This happens because the client creates the top level window first, and
70 // then the WindowTreeHost. Each WindowTreeHost has a Window, so the
71 // WindowTreeHost for top-levels has no server window.
72 bool has_server_window() const { return server_id() != kInvalidServerId; }
73
74 // See constructor for details.
75 bool create_remote_window() const { return create_remote_window_; }
76 65
77 virtual Window* GetWindow() = 0; 66 virtual Window* GetWindow() = 0;
78 67
79 // These functions are called in response to a change from the server. The 68 // These functions are called in response to a change from the server. The
80 // expectation is that in calling these WindowTreeClient is not called 69 // expectation is that in calling these WindowTreeClient is not called
81 // back. For example, SetBoundsFromServer() should not result in calling back 70 // back. For example, SetBoundsFromServer() should not result in calling back
82 // to WindowTreeClient::OnWindowMusBoundsChanged(). 71 // to WindowTreeClient::OnWindowMusBoundsChanged().
83 virtual void AddChildFromServer(WindowMus* window) = 0; 72 virtual void AddChildFromServer(WindowMus* window) = 0;
84 virtual void RemoveChildFromServer(WindowMus* child) = 0; 73 virtual void RemoveChildFromServer(WindowMus* child) = 0;
85 virtual void ReorderFromServer(WindowMus* child, 74 virtual void ReorderFromServer(WindowMus* child,
(...skipping 25 matching lines...) Expand all
111 100
112 virtual void NotifyEmbeddedAppDisconnected() = 0; 101 virtual void NotifyEmbeddedAppDisconnected() = 0;
113 102
114 private: 103 private:
115 // Just for set_server_id(), which other places should not call. 104 // Just for set_server_id(), which other places should not call.
116 friend class WindowTreeClient; 105 friend class WindowTreeClient;
117 106
118 void set_server_id(Id id) { server_id_ = id; } 107 void set_server_id(Id id) { server_id_ = id; }
119 108
120 Id server_id_ = kInvalidServerId; 109 Id server_id_ = kInvalidServerId;
121 const bool create_remote_window_; 110 const WindowMusType window_mus_type_;
122 }; 111 };
123 112
124 } // namespace aura 113 } // namespace aura
125 114
126 #endif // UI_AURA_MUS_WINDOW_MUS_H_ 115 #endif // UI_AURA_MUS_WINDOW_MUS_H_
OLDNEW
« no previous file with comments | « ui/aura/mus/window_manager_delegate.h ('k') | ui/aura/mus/window_port_mus.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698