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

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

Issue 403083002: Allow EmbedRoot to be called multiple times. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 5 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_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"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h" 12 #include "mojo/services/public/cpp/geometry/geometry_type_converters.h"
13 #include "mojo/services/public/cpp/view_manager/node.h" 13 #include "mojo/services/public/cpp/view_manager/node.h"
14 #include "mojo/services/public/cpp/view_manager/types.h" 14 #include "mojo/services/public/cpp/view_manager/types.h"
15 #include "mojo/services/public/cpp/view_manager/view_manager.h" 15 #include "mojo/services/public/cpp/view_manager/view_manager.h"
16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h" 16 #include "mojo/services/public/interfaces/view_manager/view_manager.mojom.h"
17 17
18 class SkBitmap; 18 class SkBitmap;
19 19
20 namespace mojo { 20 namespace mojo {
21 class ApplicationConnection; 21 class ApplicationConnection;
22 namespace view_manager { 22 namespace view_manager {
23 23
24 class ViewEventDispatcher;
25 class ViewManager; 24 class ViewManager;
26 class ViewManagerTransaction; 25 class ViewManagerTransaction;
27 26
28 // Manages the connection with the View Manager service. 27 // Manages the connection with the View Manager service.
29 class ViewManagerClientImpl : public ViewManager, 28 class ViewManagerClientImpl : public ViewManager,
30 public InterfaceImpl<ViewManagerClient> { 29 public InterfaceImpl<ViewManagerClient> {
31 public: 30 public:
32 explicit ViewManagerClientImpl(ApplicationConnection* connection, 31 explicit ViewManagerClientImpl(ApplicationConnection* connection,
33 ViewManagerDelegate* delegate); 32 ViewManagerDelegate* delegate);
34 virtual ~ViewManagerClientImpl(); 33 virtual ~ViewManagerClientImpl();
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 80
82 private: 81 private:
83 friend class RootObserver; 82 friend class RootObserver;
84 friend class ViewManagerTransaction; 83 friend class ViewManagerTransaction;
85 84
86 typedef ScopedVector<ViewManagerTransaction> Transactions; 85 typedef ScopedVector<ViewManagerTransaction> Transactions;
87 typedef std::map<Id, Node*> IdToNodeMap; 86 typedef std::map<Id, Node*> IdToNodeMap;
88 typedef std::map<Id, View*> IdToViewMap; 87 typedef std::map<Id, View*> IdToViewMap;
89 88
90 // Overridden from ViewManager: 89 // Overridden from ViewManager:
91 virtual void SetEventDispatcher(ViewEventDispatcher* dispatcher) OVERRIDE; 90 virtual void SetWindowManagerDelegate(
91 WindowManagerDelegate* delegate) OVERRIDE;
92 virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE; 92 virtual void DispatchEvent(View* target, EventPtr event) OVERRIDE;
93 virtual const std::string& GetEmbedderURL() const OVERRIDE; 93 virtual const std::string& GetEmbedderURL() const OVERRIDE;
94 virtual const std::vector<Node*>& GetRoots() const OVERRIDE; 94 virtual const std::vector<Node*>& GetRoots() const OVERRIDE;
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:
(...skipping 14 matching lines...) Expand all
116 OrderDirection direction) OVERRIDE; 116 OrderDirection direction) OVERRIDE;
117 virtual void OnNodeDeleted(Id node_id) OVERRIDE; 117 virtual void OnNodeDeleted(Id node_id) OVERRIDE;
118 virtual void OnNodeViewReplaced(Id node, 118 virtual void OnNodeViewReplaced(Id node,
119 Id new_view_id, 119 Id new_view_id,
120 Id old_view_id) OVERRIDE; 120 Id old_view_id) OVERRIDE;
121 virtual void OnViewDeleted(Id view_id) OVERRIDE; 121 virtual void OnViewDeleted(Id view_id) OVERRIDE;
122 virtual void OnViewInputEvent(Id view, 122 virtual void OnViewInputEvent(Id view,
123 EventPtr event, 123 EventPtr event,
124 const Callback<void()>& callback) OVERRIDE; 124 const Callback<void()>& callback) OVERRIDE;
125 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;
126 virtual void EmbedRoot(const String& url) OVERRIDE;
126 virtual void DispatchOnViewInputEvent(Id view_id, EventPtr event) OVERRIDE; 127 virtual void DispatchOnViewInputEvent(Id view_id, EventPtr event) OVERRIDE;
127 128
128 // Sync the client model with the service by enumerating the pending 129 // Sync the client model with the service by enumerating the pending
129 // transaction queue and applying them in order. 130 // transaction queue and applying them in order.
130 void Sync(); 131 void Sync();
131 132
132 // Removes |transaction| from the pending queue. |transaction| must be at the 133 // Removes |transaction| from the pending queue. |transaction| must be at the
133 // front of the queue. 134 // front of the queue.
134 void RemoveFromPendingQueue(ViewManagerTransaction* transaction); 135 void RemoveFromPendingQueue(ViewManagerTransaction* transaction);
135 136
136 void AddRoot(Node* root); 137 void AddRoot(Node* root);
137 void RemoveRoot(Node* root); 138 void RemoveRoot(Node* root);
138 139
139 bool connected_; 140 bool connected_;
140 ConnectionSpecificId connection_id_; 141 ConnectionSpecificId connection_id_;
141 ConnectionSpecificId next_id_; 142 ConnectionSpecificId next_id_;
142 143
143 std::string creator_url_; 144 std::string creator_url_;
144 145
145 Transactions pending_transactions_; 146 Transactions pending_transactions_;
146 147
147 base::Callback<void(void)> changes_acked_callback_; 148 base::Callback<void(void)> changes_acked_callback_;
148 149
149 ViewManagerDelegate* delegate_; 150 ViewManagerDelegate* delegate_;
150 ViewEventDispatcher* dispatcher_; 151 WindowManagerDelegate* window_manager_delegate_;
151 152
152 std::vector<Node*> roots_; 153 std::vector<Node*> roots_;
153 154
154 IdToNodeMap nodes_; 155 IdToNodeMap nodes_;
155 IdToViewMap views_; 156 IdToViewMap views_;
156 157
157 ViewManagerService* service_; 158 ViewManagerService* service_;
158 159
159 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl); 160 DISALLOW_COPY_AND_ASSIGN(ViewManagerClientImpl);
160 }; 161 };
161 162
162 } // namespace view_manager 163 } // namespace view_manager
163 } // namespace mojo 164 } // namespace mojo
164 165
165 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_ 166 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_LIB_VIEW_MANAGER_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/mojo_services.gypi ('k') | mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698