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 #include <set> | 9 #include <set> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "mojo/public/cpp/bindings/array.h" | 12 #include "mojo/public/cpp/bindings/array.h" |
| 13 #include "mojo/services/view_manager/display_manager.h" |
13 #include "mojo/services/view_manager/ids.h" | 14 #include "mojo/services/view_manager/ids.h" |
14 #include "mojo/services/view_manager/node.h" | 15 #include "mojo/services/view_manager/node.h" |
15 #include "mojo/services/view_manager/node_delegate.h" | 16 #include "mojo/services/view_manager/node_delegate.h" |
16 #include "mojo/services/view_manager/root_view_manager.h" | |
17 #include "mojo/services/view_manager/view_manager_export.h" | 17 #include "mojo/services/view_manager/view_manager_export.h" |
18 | 18 |
19 namespace ui { | 19 namespace ui { |
20 class Event; | 20 class Event; |
21 } | 21 } |
22 | 22 |
23 namespace mojo { | 23 namespace mojo { |
24 | 24 |
25 class ApplicationConnection; | 25 class ApplicationConnection; |
26 | 26 |
27 namespace service { | 27 namespace service { |
28 | 28 |
29 class RootViewManagerDelegate; | 29 class DisplayManagerDelegate; |
30 class ViewManagerServiceImpl; | 30 class ViewManagerServiceImpl; |
31 | 31 |
32 // RootNodeManager is responsible for managing the set of | 32 // RootNodeManager is responsible for managing the set of |
33 // ViewManagerServiceImpls as well as providing the root of the node hierarchy. | 33 // ViewManagerServiceImpls as well as providing the root of the node hierarchy. |
34 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate { | 34 class MOJO_VIEW_MANAGER_EXPORT RootNodeManager : public NodeDelegate { |
35 public: | 35 public: |
36 // Create when a ViewManagerServiceImpl is about to make a change. Ensures | 36 // Create when a ViewManagerServiceImpl is about to make a change. Ensures |
37 // clients are notified of the correct change id. | 37 // clients are notified of the correct change id. |
38 class ScopedChange { | 38 class ScopedChange { |
39 public: | 39 public: |
(...skipping 20 matching lines...) Expand all Loading... |
60 const ConnectionSpecificId connection_id_; | 60 const ConnectionSpecificId connection_id_; |
61 const bool is_delete_node_; | 61 const bool is_delete_node_; |
62 | 62 |
63 // See description of MarkConnectionAsMessaged/DidMessageConnection. | 63 // See description of MarkConnectionAsMessaged/DidMessageConnection. |
64 std::set<ConnectionSpecificId> message_ids_; | 64 std::set<ConnectionSpecificId> message_ids_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(ScopedChange); | 66 DISALLOW_COPY_AND_ASSIGN(ScopedChange); |
67 }; | 67 }; |
68 | 68 |
69 RootNodeManager(ApplicationConnection* app_connection, | 69 RootNodeManager(ApplicationConnection* app_connection, |
70 RootViewManagerDelegate* view_manager_delegate, | 70 DisplayManagerDelegate* display_manager_delegate, |
71 const Callback<void()>& native_viewport_closed_callback); | 71 const Callback<void()>& native_viewport_closed_callback); |
72 virtual ~RootNodeManager(); | 72 virtual ~RootNodeManager(); |
73 | 73 |
74 // Returns the id for the next ViewManagerServiceImpl. | 74 // Returns the id for the next ViewManagerServiceImpl. |
75 ConnectionSpecificId GetAndAdvanceNextConnectionId(); | 75 ConnectionSpecificId GetAndAdvanceNextConnectionId(); |
76 | 76 |
77 void AddConnection(ViewManagerServiceImpl* connection); | 77 void AddConnection(ViewManagerServiceImpl* connection); |
78 void RemoveConnection(ViewManagerServiceImpl* connection); | 78 void RemoveConnection(ViewManagerServiceImpl* connection); |
79 | 79 |
80 // Establishes the initial client. Similar to Connect(), but the resulting | 80 // Establishes the initial client. Similar to Connect(), but the resulting |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 Context context_; | 181 Context context_; |
182 | 182 |
183 ApplicationConnection* app_connection_; | 183 ApplicationConnection* app_connection_; |
184 | 184 |
185 // ID to use for next ViewManagerServiceImpl. | 185 // ID to use for next ViewManagerServiceImpl. |
186 ConnectionSpecificId next_connection_id_; | 186 ConnectionSpecificId next_connection_id_; |
187 | 187 |
188 // Set of ViewManagerServiceImpls. | 188 // Set of ViewManagerServiceImpls. |
189 ConnectionMap connection_map_; | 189 ConnectionMap connection_map_; |
190 | 190 |
191 RootViewManager root_view_manager_; | 191 DisplayManager display_manager_; |
192 | 192 |
193 // Root node. | 193 // Root node. |
194 scoped_ptr<Node> root_; | 194 scoped_ptr<Node> root_; |
195 | 195 |
196 // Set of ViewManagerServiceImpls created by way of Connect(). These have to | 196 // Set of ViewManagerServiceImpls created by way of Connect(). These have to |
197 // be explicitly destroyed. | 197 // be explicitly destroyed. |
198 std::set<ViewManagerServiceImpl*> connections_created_by_connect_; | 198 std::set<ViewManagerServiceImpl*> connections_created_by_connect_; |
199 | 199 |
200 // If non-null we're processing a change. The ScopedChange is not owned by us | 200 // If non-null we're processing a change. The ScopedChange is not owned by us |
201 // (it's created on the stack by ViewManagerServiceImpl). | 201 // (it's created on the stack by ViewManagerServiceImpl). |
202 ScopedChange* current_change_; | 202 ScopedChange* current_change_; |
203 | 203 |
204 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); | 204 DISALLOW_COPY_AND_ASSIGN(RootNodeManager); |
205 }; | 205 }; |
206 | 206 |
207 } // namespace service | 207 } // namespace service |
208 } // namespace mojo | 208 } // namespace mojo |
209 | 209 |
210 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ | 210 #endif // MOJO_SERVICES_VIEW_MANAGER_ROOT_NODE_MANAGER_H_ |
OLD | NEW |