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_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 virtual Node* GetNodeById(Id id) OVERRIDE; | 95 virtual Node* GetNodeById(Id id) OVERRIDE; |
96 virtual View* GetViewById(Id id) OVERRIDE; | 96 virtual View* GetViewById(Id id) OVERRIDE; |
97 | 97 |
98 // Overridden from InterfaceImpl: | 98 // Overridden from InterfaceImpl: |
99 virtual void OnConnectionEstablished() OVERRIDE; | 99 virtual void OnConnectionEstablished() OVERRIDE; |
100 | 100 |
101 // Overridden from ViewManagerClient: | 101 // Overridden from ViewManagerClient: |
102 virtual void OnViewManagerConnectionEstablished( | 102 virtual void OnViewManagerConnectionEstablished( |
103 ConnectionSpecificId connection_id, | 103 ConnectionSpecificId connection_id, |
104 const String& creator_url, | 104 const String& creator_url, |
105 Id next_server_change_id, | |
106 Array<NodeDataPtr> nodes) OVERRIDE; | 105 Array<NodeDataPtr> nodes) OVERRIDE; |
107 virtual void OnRootAdded(Array<NodeDataPtr> nodes) OVERRIDE; | 106 virtual void OnRootAdded(Array<NodeDataPtr> nodes) OVERRIDE; |
108 virtual void OnServerChangeIdAdvanced(Id next_server_change_id) OVERRIDE; | |
109 virtual void OnNodeBoundsChanged(Id node_id, | 107 virtual void OnNodeBoundsChanged(Id node_id, |
110 RectPtr old_bounds, | 108 RectPtr old_bounds, |
111 RectPtr new_bounds) OVERRIDE; | 109 RectPtr new_bounds) OVERRIDE; |
112 virtual void OnNodeHierarchyChanged(Id node_id, | 110 virtual void OnNodeHierarchyChanged(Id node_id, |
113 Id new_parent_id, | 111 Id new_parent_id, |
114 Id old_parent_id, | 112 Id old_parent_id, |
115 Id server_change_id, | |
116 Array<NodeDataPtr> nodes) OVERRIDE; | 113 Array<NodeDataPtr> nodes) OVERRIDE; |
117 virtual void OnNodeReordered(Id node_id, | 114 virtual void OnNodeReordered(Id node_id, |
118 Id relative_node_id, | 115 Id relative_node_id, |
119 OrderDirection direction, | 116 OrderDirection direction) OVERRIDE; |
120 Id server_change_id) OVERRIDE; | 117 virtual void OnNodeDeleted(Id node_id) OVERRIDE; |
121 virtual void OnNodeDeleted(Id node_id, Id server_change_id) OVERRIDE; | |
122 virtual void OnNodeViewReplaced(Id node, | 118 virtual void OnNodeViewReplaced(Id node, |
123 Id new_view_id, | 119 Id new_view_id, |
124 Id old_view_id) OVERRIDE; | 120 Id old_view_id) OVERRIDE; |
125 virtual void OnViewDeleted(Id view_id) OVERRIDE; | 121 virtual void OnViewDeleted(Id view_id) OVERRIDE; |
126 virtual void OnViewInputEvent(Id view, | 122 virtual void OnViewInputEvent(Id view, |
127 EventPtr event, | 123 EventPtr event, |
128 const Callback<void()>& callback) OVERRIDE; | 124 const Callback<void()>& callback) OVERRIDE; |
129 virtual void OnFocusChanged(Id gained_focus_id, Id lost_focus_id) OVERRIDE; | 125 virtual void OnFocusChanged(Id gained_focus_id, Id lost_focus_id) OVERRIDE; |
130 virtual void DispatchOnViewInputEvent(Id view_id, EventPtr event) OVERRIDE; | 126 virtual void DispatchOnViewInputEvent(Id view_id, EventPtr event) OVERRIDE; |
131 | 127 |
132 // Sync the client model with the service by enumerating the pending | 128 // Sync the client model with the service by enumerating the pending |
133 // transaction queue and applying them in order. | 129 // transaction queue and applying them in order. |
134 void Sync(); | 130 void Sync(); |
135 | 131 |
136 // Removes |transaction| from the pending queue. |transaction| must be at the | 132 // Removes |transaction| from the pending queue. |transaction| must be at the |
137 // front of the queue. | 133 // front of the queue. |
138 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); | 134 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); |
139 | 135 |
140 void AddRoot(Node* root); | 136 void AddRoot(Node* root); |
141 void RemoveRoot(Node* root); | 137 void RemoveRoot(Node* root); |
142 | 138 |
143 bool connected_; | 139 bool connected_; |
144 ConnectionSpecificId connection_id_; | 140 ConnectionSpecificId connection_id_; |
145 ConnectionSpecificId next_id_; | 141 ConnectionSpecificId next_id_; |
146 Id next_server_change_id_; | |
147 | 142 |
148 std::string creator_url_; | 143 std::string creator_url_; |
149 | 144 |
150 Transactions pending_transactions_; | 145 Transactions pending_transactions_; |
151 | 146 |
152 base::Callback<void(void)> changes_acked_callback_; | 147 base::Callback<void(void)> changes_acked_callback_; |
153 | 148 |
154 ViewManagerDelegate* delegate_; | 149 ViewManagerDelegate* delegate_; |
155 ViewEventDispatcher* dispatcher_; | 150 ViewEventDispatcher* dispatcher_; |
156 | 151 |
157 std::vector<Node*> roots_; | 152 std::vector<Node*> roots_; |
158 | 153 |
159 IdToNodeMap nodes_; | 154 IdToNodeMap nodes_; |
160 IdToViewMap views_; | 155 IdToViewMap views_; |
161 | 156 |
162 ViewManagerService* service_; | 157 ViewManagerService* service_; |
163 | 158 |
164 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); | 159 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); |
165 }; | 160 }; |
166 | 161 |
167 } // namespace view_manager | 162 } // namespace view_manager |
168 } // namespace mojo | 163 } // namespace mojo |
169 | 164 |
170 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ | 165 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ |
OLD | NEW |