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

Side by Side Diff: mojo/services/view_manager/root_node_manager.h

Issue 250633003: Adds more to viewmanager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 RootNodeManager(); 44 RootNodeManager();
45 virtual ~RootNodeManager(); 45 virtual ~RootNodeManager();
46 46
47 // Returns the id for the next ViewManagerConnection. 47 // Returns the id for the next ViewManagerConnection.
48 uint16_t GetAndAdvanceNextConnectionId(); 48 uint16_t GetAndAdvanceNextConnectionId();
49 49
50 void AddConnection(ViewManagerConnection* connection); 50 void AddConnection(ViewManagerConnection* connection);
51 void RemoveConnection(ViewManagerConnection* connection); 51 void RemoveConnection(ViewManagerConnection* connection);
52 52
53 // Returns the connection by id.
54 ViewManagerConnection* GetConnection(uint16_t connection_id);
55
53 // Returns the Node identified by |id|. 56 // Returns the Node identified by |id|.
54 Node* GetNode(const NodeId& id); 57 Node* GetNode(const NodeId& id);
55 58
56 // Notifies all ViewManagerConnections of a hierarchy change. 59 // Returns the View identified by |id|.
60 View* GetView(const ViewId& id);
61
62 // These functions trivially delegate to all ViewManagerConnections, which in
63 // term notify their clients.
57 void NotifyNodeHierarchyChanged(const NodeId& node, 64 void NotifyNodeHierarchyChanged(const NodeId& node,
58 const NodeId& new_parent, 65 const NodeId& new_parent,
59 const NodeId& old_parent); 66 const NodeId& old_parent);
67 void NotifyNodeViewChanged(const NodeId& node,
68 const ViewId& new_view_id,
69 const ViewId& old_view_id);
60 70
61 private: 71 private:
62 // Tracks a change. 72 // Tracks a change.
63 struct Change { 73 struct Change {
64 Change(int32_t connection_id, int32_t change_id) 74 Change(int32_t connection_id, int32_t change_id)
65 : connection_id(connection_id), 75 : connection_id(connection_id),
66 change_id(change_id) { 76 change_id(change_id) {
67 } 77 }
68 78
69 int32_t connection_id; 79 int32_t connection_id;
(...skipping 17 matching lines...) Expand all
87 virtual void OnCreated() OVERRIDE; 97 virtual void OnCreated() OVERRIDE;
88 virtual void OnDestroyed() OVERRIDE; 98 virtual void OnDestroyed() OVERRIDE;
89 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; 99 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE;
90 virtual void OnEvent(const Event& event, 100 virtual void OnEvent(const Event& event,
91 const mojo::Callback<void()>& callback) OVERRIDE; 101 const mojo::Callback<void()>& callback) OVERRIDE;
92 102
93 // Overriden from NodeDelegate: 103 // Overriden from NodeDelegate:
94 virtual void OnNodeHierarchyChanged(const NodeId& node, 104 virtual void OnNodeHierarchyChanged(const NodeId& node,
95 const NodeId& new_parent, 105 const NodeId& new_parent,
96 const NodeId& old_parent) OVERRIDE; 106 const NodeId& old_parent) OVERRIDE;
107 virtual void OnNodeViewChanged(const NodeId& node,
108 const ViewId& new_view_id,
109 const ViewId& old_view_id) OVERRIDE;
97 110
98 // ID to use for next ViewManagerConnection. 111 // ID to use for next ViewManagerConnection.
99 uint16_t next_connection_id_; 112 uint16_t next_connection_id_;
100 113
101 // Set of ViewManagerConnections. 114 // Set of ViewManagerConnections.
102 ConnectionMap connection_map_; 115 ConnectionMap connection_map_;
103 116
104 // Root node. 117 // Root node.
105 Node root_; 118 Node root_;
106 119
107 // If non-null we're processing a change. 120 // If non-null we're processing a change.
108 scoped_ptr<Change> change_; 121 scoped_ptr<Change> change_;
109 122
110 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); 123 DISALLOW_COPY_AND_ASSIGN(RootNodeManager);
111 }; 124 };
112 125
113 } // namespace view_manager 126 } // namespace view_manager
114 } // namespace services 127 } // namespace services
115 } // namespace mojo 128 } // namespace mojo
116 129
117 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ 130 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698