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/callback.h" | 9 #include "base/callback.h" |
10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "mojo/geometry/geometry_type_converters.h" |
12 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" | 13 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" |
13 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" | 14 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class RunLoop; | 17 class RunLoop; |
17 } | 18 } |
18 | 19 |
19 namespace mojo { | 20 namespace mojo { |
20 namespace view_manager { | 21 namespace view_manager { |
21 | 22 |
(...skipping 19 matching lines...) Expand all Loading... |
41 // These methods take TransportIds. For views owned by the current connection, | 42 // These methods take TransportIds. For views owned by the current connection, |
42 // the connection id high word can be zero. In all cases, the TransportId 0x1 | 43 // the connection id high word can be zero. In all cases, the TransportId 0x1 |
43 // refers to the root node. | 44 // refers to the root node. |
44 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); | 45 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); |
45 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); | 46 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); |
46 | 47 |
47 bool OwnsNode(TransportNodeId id) const; | 48 bool OwnsNode(TransportNodeId id) const; |
48 bool OwnsView(TransportViewId id) const; | 49 bool OwnsView(TransportViewId id) const; |
49 | 50 |
50 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); | 51 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); |
| 52 void SetBounds(TransportNodeId node_id, const gfx::Rect& bounds); |
51 | 53 |
52 void set_changes_acked_callback(const base::Callback<void(void)>& callback) { | 54 void set_changes_acked_callback(const base::Callback<void(void)>& callback) { |
53 changes_acked_callback_ = callback; | 55 changes_acked_callback_ = callback; |
54 } | 56 } |
55 void ClearChangesAckedCallback() { | 57 void ClearChangesAckedCallback() { |
56 changes_acked_callback_ = base::Callback<void(void)>(); | 58 changes_acked_callback_ = base::Callback<void(void)>(); |
57 } | 59 } |
58 | 60 |
59 private: | 61 private: |
60 friend class ViewManagerTransaction; | 62 friend class ViewManagerTransaction; |
61 typedef ScopedVector<ViewManagerTransaction> Transactions; | 63 typedef ScopedVector<ViewManagerTransaction> Transactions; |
62 | 64 |
63 // Overridden from IViewManagerClient: | 65 // Overridden from IViewManagerClient: |
64 virtual void OnConnectionEstablished( | 66 virtual void OnConnectionEstablished( |
65 TransportConnectionId connection_id, | 67 TransportConnectionId connection_id, |
66 TransportChangeId next_server_change_id, | 68 TransportChangeId next_server_change_id, |
67 const mojo::Array<INode>& nodes) OVERRIDE; | 69 const mojo::Array<INode>& nodes) OVERRIDE; |
68 virtual void OnServerChangeIdAdvanced( | 70 virtual void OnServerChangeIdAdvanced( |
69 uint32_t next_server_change_id) OVERRIDE; | 71 uint32_t next_server_change_id) OVERRIDE; |
| 72 virtual void OnNodeBoundsChanged(uint32 node_id, |
| 73 const Rect& old_bounds, |
| 74 const Rect& new_bounds) OVERRIDE; |
70 virtual void OnNodeHierarchyChanged( | 75 virtual void OnNodeHierarchyChanged( |
71 uint32 node_id, | 76 uint32 node_id, |
72 uint32 new_parent_id, | 77 uint32 new_parent_id, |
73 uint32 old_parent_id, | 78 uint32 old_parent_id, |
74 TransportChangeId server_change_id, | 79 TransportChangeId server_change_id, |
75 const mojo::Array<INode>& nodes) OVERRIDE; | 80 const mojo::Array<INode>& nodes) OVERRIDE; |
76 virtual void OnNodeDeleted(TransportNodeId node_id, | 81 virtual void OnNodeDeleted(TransportNodeId node_id, |
77 TransportChangeId server_change_id) OVERRIDE; | 82 TransportChangeId server_change_id) OVERRIDE; |
78 virtual void OnNodeViewReplaced(uint32_t node, | 83 virtual void OnNodeViewReplaced(uint32_t node, |
79 uint32_t new_view_id, | 84 uint32_t new_view_id, |
(...skipping 26 matching lines...) Expand all Loading... |
106 | 111 |
107 IViewManagerPtr service_; | 112 IViewManagerPtr service_; |
108 | 113 |
109 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); | 114 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); |
110 }; | 115 }; |
111 | 116 |
112 } // namespace view_manager | 117 } // namespace view_manager |
113 } // namespace mojo | 118 } // namespace mojo |
114 | 119 |
115 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ | 120 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H
_ |
OLD | NEW |