Index: mojo/services/view_manager/server_view.h |
diff --git a/mojo/services/view_manager/server_view.h b/mojo/services/view_manager/server_view.h |
index 05d000c0beed877eb521ca82aec413ec84c7f7c8..b12c7bf9b5f98f3e228fad415a1896d387752165 100644 |
--- a/mojo/services/view_manager/server_view.h |
+++ b/mojo/services/view_manager/server_view.h |
@@ -8,6 +8,7 @@ |
#include <vector> |
#include "base/logging.h" |
+#include "base/observer_list.h" |
#include "cc/surfaces/surface_id.h" |
#include "mojo/services/view_manager/ids.h" |
#include "third_party/mojo_services/src/view_manager/public/interfaces/view_manager.mojom.h" |
@@ -17,6 +18,7 @@ |
namespace view_manager { |
class ServerViewDelegate; |
+class ServerViewObserver; |
// Server side representation of a view. Delegate is informed of interesting |
// events. |
@@ -24,11 +26,18 @@ class ServerViewDelegate; |
// It is assumed that all functions that mutate the tree have validated the |
// mutation is possible before hand. For example, Reorder() assumes the supplied |
// view is a child and not already in position. |
+// |
+// ServerViews do not own their children. If you delete a view that has children |
+// the children are implicitly removed. Similarly if a view has a parent and the |
+// view is deleted the deleted view is implicitly removed from the parent. |
class ServerView { |
public: |
ServerView(ServerViewDelegate* delegate, const ViewId& id); |
virtual ~ServerView(); |
+ void AddObserver(ServerViewObserver* observer); |
+ void RemoveObserver(ServerViewObserver* observer); |
+ |
const ViewId& id() const { return id_; } |
void Add(ServerView* child); |
@@ -101,6 +110,8 @@ class ServerView { |
std::map<std::string, std::vector<uint8_t>> properties_; |
+ ObserverList<ServerViewObserver> observers_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ServerView); |
}; |