OLD | NEW |
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 14 matching lines...) Expand all Loading... |
25 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager | 25 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager |
26 : public NativeViewportClient, | 26 : public NativeViewportClient, |
27 public NodeDelegate { | 27 public NodeDelegate { |
28 public: | 28 public: |
29 // Create when a ViewManagerConnection is about to make a change. Ensures | 29 // Create when a ViewManagerConnection is about to make a change. Ensures |
30 // clients are notified of the correct change id. | 30 // clients are notified of the correct change id. |
31 class ScopedChange { | 31 class ScopedChange { |
32 public: | 32 public: |
33 ScopedChange(ViewManagerConnection* connection, | 33 ScopedChange(ViewManagerConnection* connection, |
34 RootNodeManager* root, | 34 RootNodeManager* root, |
35 ChangeId change_id); | 35 int32_t change_id); |
36 ~ScopedChange(); | 36 ~ScopedChange(); |
37 | 37 |
38 private: | 38 private: |
39 RootNodeManager* root_; | 39 RootNodeManager* root_; |
40 | 40 |
41 DISALLOW_COPY_AND_ASSIGN(ScopedChange); | 41 DISALLOW_COPY_AND_ASSIGN(ScopedChange); |
42 }; | 42 }; |
43 | 43 |
44 RootNodeManager(); | 44 RootNodeManager(); |
45 virtual ~RootNodeManager(); | 45 virtual ~RootNodeManager(); |
(...skipping 18 matching lines...) Expand all Loading... |
64 void NotifyNodeHierarchyChanged(const NodeId& node, | 64 void NotifyNodeHierarchyChanged(const NodeId& node, |
65 const NodeId& new_parent, | 65 const NodeId& new_parent, |
66 const NodeId& old_parent); | 66 const NodeId& old_parent); |
67 void NotifyNodeViewReplaced(const NodeId& node, | 67 void NotifyNodeViewReplaced(const NodeId& node, |
68 const ViewId& new_view_id, | 68 const ViewId& new_view_id, |
69 const ViewId& old_view_id); | 69 const ViewId& old_view_id); |
70 | 70 |
71 private: | 71 private: |
72 // Tracks a change. | 72 // Tracks a change. |
73 struct Change { | 73 struct Change { |
74 Change(int32_t connection_id, ChangeId change_id) | 74 Change(int32_t connection_id, int32_t change_id) |
75 : connection_id(connection_id), | 75 : connection_id(connection_id), |
76 change_id(change_id) { | 76 change_id(change_id) { |
77 } | 77 } |
78 | 78 |
79 int32_t connection_id; | 79 int32_t connection_id; |
80 ChangeId change_id; | 80 int32_t change_id; |
81 }; | 81 }; |
82 | 82 |
83 typedef std::map<uint16_t, ViewManagerConnection*> ConnectionMap; | 83 typedef std::map<uint16_t, ViewManagerConnection*> ConnectionMap; |
84 | 84 |
85 // Invoked when a particular connection is about to make a change. Records | 85 // Invoked when a particular connection is about to make a change. Records |
86 // the |change_id| so that it can be supplied to the clients by way of | 86 // the |change_id| so that it can be supplied to the clients by way of |
87 // OnNodeHierarchyChanged(). | 87 // OnNodeHierarchyChanged(). |
88 // Changes should never nest, meaning each PrepareForChange() must be | 88 // Changes should never nest, meaning each PrepareForChange() must be |
89 // balanced with a call to FinishChange() with no PrepareForChange() | 89 // balanced with a call to FinishChange() with no PrepareForChange() |
90 // in between. | 90 // in between. |
91 void PrepareForChange(ViewManagerConnection* connection, ChangeId change_id); | 91 void PrepareForChange(ViewManagerConnection* connection, int32_t change_id); |
92 | 92 |
93 // Balances a call to PrepareForChange(). | 93 // Balances a call to PrepareForChange(). |
94 void FinishChange(); | 94 void FinishChange(); |
95 | 95 |
96 // Overridden from NativeViewportClient: | 96 // Overridden from NativeViewportClient: |
97 virtual void OnCreated() OVERRIDE; | 97 virtual void OnCreated() OVERRIDE; |
98 virtual void OnDestroyed() OVERRIDE; | 98 virtual void OnDestroyed() OVERRIDE; |
99 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; | 99 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE; |
100 virtual void OnEvent(const Event& event, | 100 virtual void OnEvent(const Event& event, |
101 const mojo::Callback<void()>& callback) OVERRIDE; | 101 const mojo::Callback<void()>& callback) OVERRIDE; |
(...skipping 19 matching lines...) Expand all Loading... |
121 scoped_ptr<Change> change_; | 121 scoped_ptr<Change> change_; |
122 | 122 |
123 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); | 123 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); |
124 }; | 124 }; |
125 | 125 |
126 } // namespace view_manager | 126 } // namespace view_manager |
127 } // namespace services | 127 } // namespace services |
128 } // namespace mojo | 128 } // namespace mojo |
129 | 129 |
130 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ | 130 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
OLD | NEW |