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_SYNCHRONIZER_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 class ViewManagerTransaction; | 23 class ViewManagerTransaction; |
24 | 24 |
25 // Manages the connection with the View Manager service. | 25 // Manages the connection with the View Manager service. |
26 class ViewManagerSynchronizer : public IViewManagerClient { | 26 class ViewManagerSynchronizer : public IViewManagerClient { |
27 public: | 27 public: |
28 explicit ViewManagerSynchronizer(ViewManager* view_manager); | 28 explicit ViewManagerSynchronizer(ViewManager* view_manager); |
29 virtual ~ViewManagerSynchronizer(); | 29 virtual ~ViewManagerSynchronizer(); |
30 | 30 |
31 bool connected() const { return connected_; } | 31 bool connected() const { return connected_; } |
32 | 32 |
33 // API exposed to the node implementation that pushes local changes to the | 33 // API exposed to the node/view implementations that pushes local changes to |
34 // service. | 34 // the service. |
35 TransportNodeId CreateViewTreeNode(); | 35 TransportNodeId CreateViewTreeNode(); |
36 void DestroyViewTreeNode(TransportNodeId node_id); | 36 void DestroyViewTreeNode(TransportNodeId node_id); |
37 | 37 |
| 38 TransportViewId CreateView(); |
| 39 void DestroyView(TransportViewId view_id); |
| 40 |
38 // These methods take TransportIds. For views owned by the current connection, | 41 // These methods take TransportIds. For views owned by the current connection, |
39 // the connection id high word can be zero. In all cases, the TransportId 0x1 | 42 // the connection id high word can be zero. In all cases, the TransportId 0x1 |
40 // refers to the root node. | 43 // refers to the root node. |
41 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); | 44 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); |
42 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); | 45 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); |
43 | 46 |
44 bool OwnsNode(TransportNodeId id) const; | 47 bool OwnsNode(TransportNodeId id) const; |
| 48 bool OwnsView(TransportViewId id) const; |
| 49 |
| 50 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); |
45 | 51 |
46 private: | 52 private: |
47 friend class ViewManagerTransaction; | 53 friend class ViewManagerTransaction; |
48 typedef ScopedVector<ViewManagerTransaction> Transactions; | 54 typedef ScopedVector<ViewManagerTransaction> Transactions; |
49 | 55 |
50 // Overridden from IViewManagerClient: | 56 // Overridden from IViewManagerClient: |
51 virtual void OnConnectionEstablished(uint16 connection_id) OVERRIDE; | 57 virtual void OnConnectionEstablished(uint16 connection_id) OVERRIDE; |
52 virtual void OnNodeHierarchyChanged(uint32 node_id, | 58 virtual void OnNodeHierarchyChanged(uint32 node_id, |
53 uint32 new_parent_id, | 59 uint32 new_parent_id, |
54 uint32 old_parent_id, | 60 uint32 old_parent_id, |
55 uint32 change_id) OVERRIDE; | 61 uint32 change_id) OVERRIDE; |
56 virtual void OnNodeViewReplaced(uint32_t node, | 62 virtual void OnNodeViewReplaced(uint32_t node, |
57 uint32_t new_view_id, | 63 uint32_t new_view_id, |
58 uint32_t old_view_id, | 64 uint32_t old_view_id, |
59 uint32_t change_id) OVERRIDE; | 65 uint32_t change_id) OVERRIDE; |
60 virtual void OnNodeDeleted(uint32_t node_id, uint32_t change_id) OVERRIDE; | 66 virtual void OnNodeDeleted(uint32_t node_id, uint32_t change_id) OVERRIDE; |
| 67 virtual void OnViewDeleted(uint32_t view_id, uint32_t change_id) OVERRIDE; |
61 | 68 |
62 // Called to schedule a sync of the client model with the service after a | 69 // Called to schedule a sync of the client model with the service after a |
63 // return to the message loop. | 70 // return to the message loop. |
64 void ScheduleSync(); | 71 void ScheduleSync(); |
65 | 72 |
66 // Sync the client model with the service by enumerating the pending | 73 // Sync the client model with the service by enumerating the pending |
67 // transaction queue and applying them in order. | 74 // transaction queue and applying them in order. |
68 void DoSync(); | 75 void DoSync(); |
69 | 76 |
70 // Used by individual transactions to generate a connection-specific change | 77 // Used by individual transactions to generate a connection-specific change |
(...skipping 25 matching lines...) Expand all Loading... |
96 IViewManagerPtr service_; | 103 IViewManagerPtr service_; |
97 | 104 |
98 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); | 105 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); |
99 }; | 106 }; |
100 | 107 |
101 } // namespace view_manager | 108 } // namespace view_manager |
102 } // namespace services | 109 } // namespace services |
103 } // namespace mojo | 110 } // namespace mojo |
104 | 111 |
105 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ | 112 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ |
OLD | NEW |