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

Unified Diff: mojo/services/view_manager/server_view.h

Issue 1092033003: Pulls display related changes from mojo to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/services/view_manager/gesture_manager_unittest.cc ('k') | mojo/services/view_manager/server_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « mojo/services/view_manager/gesture_manager_unittest.cc ('k') | mojo/services/view_manager/server_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698