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

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

Issue 2470963002: Makes it possible for clients to directly create WindowTreeHostMus (Closed)
Patch Set: includes 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 enum class ChangeSource { 49 enum class ChangeSource {
50 // The change was made locally. 50 // The change was made locally.
51 LOCAL, 51 LOCAL,
52 // The change originated from the server. 52 // The change originated from the server.
53 SERVER, 53 SERVER,
54 }; 54 };
55 55
56 // |create_remote_window| indicates whether a window should be created on the 56 // |create_remote_window| indicates whether a window should be created on the
57 // server. Generally |create_remote_window| should be true, only in rare 57 // server. Generally |create_remote_window| should be true, only in rare
58 // exceptions (such as the root of a WindowTreeHost) is it false. 58 // exceptions (such as the root of a WindowTreeHost) is it false.
sadrul 2016/11/02 16:03:04 Update the doc?
sky 2016/11/02 16:53:23 I nuked it. There isn't really much to say.
59 explicit WindowMus(bool create_remote_window) 59 explicit WindowMus(WindowMusType window_mus_type)
60 : create_remote_window_(create_remote_window) {} 60 : window_mus_type_(window_mus_type) {}
61 virtual ~WindowMus() {} 61 virtual ~WindowMus() {}
62 62
63 // Returns the WindowMus associated with |window|. 63 // Returns the WindowMus associated with |window|.
64 static WindowMus* Get(Window* window); 64 static WindowMus* Get(Window* window);
65 65
66 Id server_id() const { return server_id_; } 66 Id server_id() const { return server_id_; }
67 67
68 // Top level windows may have a root window with no associated server window. 68 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 69
77 virtual Window* GetWindow() = 0; 70 virtual Window* GetWindow() = 0;
78 71
79 // These functions are called in response to a change from the server. The 72 // These functions are called in response to a change from the server. The
80 // expectation is that in calling these WindowTreeClient is not called 73 // expectation is that in calling these WindowTreeClient is not called
81 // back. For example, SetBoundsFromServer() should not result in calling back 74 // back. For example, SetBoundsFromServer() should not result in calling back
82 // to WindowTreeClient::OnWindowMusBoundsChanged(). 75 // to WindowTreeClient::OnWindowMusBoundsChanged().
83 virtual void AddChildFromServer(WindowMus* window) = 0; 76 virtual void AddChildFromServer(WindowMus* window) = 0;
84 virtual void RemoveChildFromServer(WindowMus* child) = 0; 77 virtual void RemoveChildFromServer(WindowMus* child) = 0;
85 virtual void ReorderFromServer(WindowMus* child, 78 virtual void ReorderFromServer(WindowMus* child,
(...skipping 25 matching lines...) Expand all
111 104
112 virtual void NotifyEmbeddedAppDisconnected() = 0; 105 virtual void NotifyEmbeddedAppDisconnected() = 0;
113 106
114 private: 107 private:
115 // Just for set_server_id(), which other places should not call. 108 // Just for set_server_id(), which other places should not call.
116 friend class WindowTreeClient; 109 friend class WindowTreeClient;
117 110
118 void set_server_id(Id id) { server_id_ = id; } 111 void set_server_id(Id id) { server_id_ = id; }
119 112
120 Id server_id_ = kInvalidServerId; 113 Id server_id_ = kInvalidServerId;
121 const bool create_remote_window_; 114 const WindowMusType window_mus_type_;
122 }; 115 };
123 116
124 } // namespace aura 117 } // namespace aura
125 118
126 #endif // UI_AURA_MUS_WINDOW_MUS_H_ 119 #endif // UI_AURA_MUS_WINDOW_MUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698