Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_synchronizer.h

Issue 320193002: Consolidates view_manager typedefs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: formatting Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 11 matching lines...) Expand all
22 class ViewManager; 22 class ViewManager;
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 InterfaceImpl<IViewManagerClient> { 26 class ViewManagerSynchronizer : public InterfaceImpl<IViewManagerClient> {
27 public: 27 public:
28 explicit ViewManagerSynchronizer(ViewManagerDelegate* delegate); 28 explicit ViewManagerSynchronizer(ViewManagerDelegate* delegate);
29 virtual ~ViewManagerSynchronizer(); 29 virtual ~ViewManagerSynchronizer();
30 30
31 bool connected() const { return connected_; } 31 bool connected() const { return connected_; }
32 TransportConnectionId connection_id() const { return connection_id_; } 32 ConnectionSpecificId connection_id() const { return connection_id_; }
33 33
34 // API exposed to the node/view implementations that pushes local changes to 34 // API exposed to the node/view implementations that pushes local changes to
35 // the service. 35 // the service.
36 TransportNodeId CreateViewTreeNode(); 36 Id CreateViewTreeNode();
37 void DestroyViewTreeNode(TransportNodeId node_id); 37 void DestroyViewTreeNode(Id node_id);
38 38
39 TransportViewId CreateView(); 39 Id CreateView();
40 void DestroyView(TransportViewId view_id); 40 void DestroyView(Id view_id);
41 41
42 // These methods take TransportIds. For views owned by the current connection, 42 // These methods take TransportIds. For views owned by the current connection,
43 // 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
44 // refers to the root node. 44 // refers to the root node.
45 void AddChild(TransportNodeId child_id, TransportNodeId parent_id); 45 void AddChild(Id child_id, Id parent_id);
46 void RemoveChild(TransportNodeId child_id, TransportNodeId parent_id); 46 void RemoveChild(Id child_id, Id parent_id);
47 47
48 bool OwnsNode(TransportNodeId id) const; 48 bool OwnsNode(Id id) const;
49 bool OwnsView(TransportViewId id) const; 49 bool OwnsView(Id id) const;
50 50
51 void SetActiveView(TransportNodeId node_id, TransportViewId view_id); 51 void SetActiveView(Id node_id, Id view_id);
52 void SetBounds(TransportNodeId node_id, const gfx::Rect& bounds); 52 void SetBounds(Id node_id, const gfx::Rect& bounds);
53 void SetViewContents(TransportViewId view_id, const SkBitmap& contents); 53 void SetViewContents(Id view_id, const SkBitmap& contents);
54 54
55 void Embed(const String& url, TransportNodeId node_id); 55 void Embed(const String& url, Id node_id);
56 56
57 void set_changes_acked_callback(const base::Callback<void(void)>& callback) { 57 void set_changes_acked_callback(const base::Callback<void(void)>& callback) {
58 changes_acked_callback_ = callback; 58 changes_acked_callback_ = callback;
59 } 59 }
60 void ClearChangesAckedCallback() { 60 void ClearChangesAckedCallback() {
61 changes_acked_callback_ = base::Callback<void(void)>(); 61 changes_acked_callback_ = base::Callback<void(void)>();
62 } 62 }
63 63
64 private: 64 private:
65 friend class ViewManagerTransaction; 65 friend class ViewManagerTransaction;
66 typedef ScopedVector<ViewManagerTransaction> Transactions; 66 typedef ScopedVector<ViewManagerTransaction> Transactions;
67 67
68 // Overridden from InterfaceImpl: 68 // Overridden from InterfaceImpl:
69 virtual void OnConnectionEstablished() OVERRIDE; 69 virtual void OnConnectionEstablished() OVERRIDE;
70 70
71 // Overridden from IViewManagerClient: 71 // Overridden from IViewManagerClient:
72 virtual void OnViewManagerConnectionEstablished( 72 virtual void OnViewManagerConnectionEstablished(
73 TransportConnectionId connection_id, 73 ConnectionSpecificId connection_id,
74 TransportChangeId next_server_change_id, 74 Id next_server_change_id,
75 mojo::Array<INodePtr> nodes) OVERRIDE; 75 mojo::Array<INodePtr> nodes) OVERRIDE;
76 virtual void OnRootsAdded(Array<INodePtr> nodes) OVERRIDE; 76 virtual void OnRootsAdded(Array<INodePtr> nodes) OVERRIDE;
77 virtual void OnServerChangeIdAdvanced( 77 virtual void OnServerChangeIdAdvanced(Id next_server_change_id) OVERRIDE;
78 uint32_t next_server_change_id) OVERRIDE; 78 virtual void OnNodeBoundsChanged(Id node_id,
79 virtual void OnNodeBoundsChanged(uint32 node_id,
80 RectPtr old_bounds, 79 RectPtr old_bounds,
81 RectPtr new_bounds) OVERRIDE; 80 RectPtr new_bounds) OVERRIDE;
82 virtual void OnNodeHierarchyChanged( 81 virtual void OnNodeHierarchyChanged(Id node_id,
83 uint32 node_id, 82 Id new_parent_id,
84 uint32 new_parent_id, 83 Id old_parent_id,
85 uint32 old_parent_id, 84 Id server_change_id,
86 TransportChangeId server_change_id, 85 mojo::Array<INodePtr> nodes) OVERRIDE;
87 mojo::Array<INodePtr> nodes) OVERRIDE; 86 virtual void OnNodeDeleted(Id node_id, Id server_change_id) OVERRIDE;
88 virtual void OnNodeDeleted(TransportNodeId node_id, 87 virtual void OnNodeViewReplaced(Id node,
89 TransportChangeId server_change_id) OVERRIDE; 88 Id new_view_id,
90 virtual void OnNodeViewReplaced(uint32_t node, 89 Id old_view_id) OVERRIDE;
91 uint32_t new_view_id, 90 virtual void OnViewDeleted(Id view_id) OVERRIDE;
92 uint32_t old_view_id) OVERRIDE; 91 virtual void OnViewInputEvent(Id view,
93 virtual void OnViewDeleted(uint32_t view_id) OVERRIDE;
94 virtual void OnViewInputEvent(uint32_t view,
95 EventPtr event, 92 EventPtr event,
96 const Callback<void()>& callback) OVERRIDE; 93 const Callback<void()>& callback) OVERRIDE;
97 94
98 // Sync the client model with the service by enumerating the pending 95 // Sync the client model with the service by enumerating the pending
99 // transaction queue and applying them in order. 96 // transaction queue and applying them in order.
100 void Sync(); 97 void Sync();
101 98
102 // Removes |transaction| from the pending queue. |transaction| must be at the 99 // Removes |transaction| from the pending queue. |transaction| must be at the
103 // front of the queue. 100 // front of the queue.
104 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); 101 void RemoveFromPendingQueue(ViewManagerTransaction* transaction);
105 102
106 ViewManager* view_manager() { return view_manager_.get(); } 103 ViewManager* view_manager() { return view_manager_.get(); }
107 104
108 scoped_ptr<ViewManager> view_manager_; 105 scoped_ptr<ViewManager> view_manager_;
109 bool connected_; 106 bool connected_;
110 TransportConnectionId connection_id_; 107 ConnectionSpecificId connection_id_;
111 uint16_t next_id_; 108 ConnectionSpecificId next_id_;
112 TransportChangeId next_server_change_id_; 109 Id next_server_change_id_;
113 110
114 Transactions pending_transactions_; 111 Transactions pending_transactions_;
115 112
116 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_; 113 base::WeakPtrFactory<ViewManagerSynchronizer> sync_factory_;
117 114
118 base::Callback<void(void)> changes_acked_callback_; 115 base::Callback<void(void)> changes_acked_callback_;
119 116
120 IViewManager* service_; 117 IViewManager* service_;
121 118
122 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer); 119 DISALLOW_COPY_AND_ASSIGN(ViewManagerSynchronizer);
123 }; 120 };
124 121
125 } // namespace view_manager 122 } // namespace view_manager
126 } // namespace mojo 123 } // namespace mojo
127 124
128 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H _ 125 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_SYNCHRONIZER_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698