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

Side by Side Diff: mojo/services/view_manager/view_manager_service_impl.h

Issue 433513005: Pass ServiceProvider thru ViewManagerService::Embed() allowing embedder & embeddee to expose servic… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 28 matching lines...) Expand all
39 39
40 // Manages a connection from the client. 40 // Manages a connection from the client.
41 class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl 41 class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl
42 : public InterfaceImpl<ViewManagerService>, 42 : public InterfaceImpl<ViewManagerService>,
43 public AccessPolicyDelegate { 43 public AccessPolicyDelegate {
44 public: 44 public:
45 ViewManagerServiceImpl(RootNodeManager* root_node_manager, 45 ViewManagerServiceImpl(RootNodeManager* root_node_manager,
46 ConnectionSpecificId creator_id, 46 ConnectionSpecificId creator_id,
47 const std::string& creator_url, 47 const std::string& creator_url,
48 const std::string& url, 48 const std::string& url,
49 const NodeId& root_id); 49 const NodeId& root_id,
50 InterfaceRequest<ServiceProvider> service_provider);
50 virtual ~ViewManagerServiceImpl(); 51 virtual ~ViewManagerServiceImpl();
51 52
52 // Used to mark this connection as originating from a call to 53 // Used to mark this connection as originating from a call to
53 // ViewManagerService::Connect(). When set OnConnectionError() deletes |this|. 54 // ViewManagerService::Connect(). When set OnConnectionError() deletes |this|.
54 void set_delete_on_connection_error() { delete_on_connection_error_ = true; } 55 void set_delete_on_connection_error() { delete_on_connection_error_ = true; }
55 56
56 ConnectionSpecificId id() const { return id_; } 57 ConnectionSpecificId id() const { return id_; }
57 ConnectionSpecificId creator_id() const { return creator_id_; } 58 ConnectionSpecificId creator_id() const { return creator_id_; }
58 const std::string& url() const { return url_; } 59 const std::string& url() const { return url_; }
59 60
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // to |nodes|, marks |node| as known and recurses. 136 // to |nodes|, marks |node| as known and recurses.
136 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes); 137 void GetUnknownNodesFrom(const Node* node, std::vector<const Node*>* nodes);
137 138
138 // Removes |node| and all its descendants from |known_nodes_|. This does not 139 // Removes |node| and all its descendants from |known_nodes_|. This does not
139 // recurse through nodes that were created by this connection. All nodes owned 140 // recurse through nodes that were created by this connection. All nodes owned
140 // by this connection are added to |local_nodes|. 141 // by this connection are added to |local_nodes|.
141 void RemoveFromKnown(const Node* node, std::vector<Node*>* local_nodes); 142 void RemoveFromKnown(const Node* node, std::vector<Node*>* local_nodes);
142 143
143 // Adds |node_id| to the set of roots this connection knows about. The caller 144 // Adds |node_id| to the set of roots this connection knows about. The caller
144 // should have verified |node_id| is not among the roots of this connection. 145 // should have verified |node_id| is not among the roots of this connection.
145 void AddRoot(const NodeId& node_id); 146 void AddRoot(const NodeId& node_id,
147 InterfaceRequest<ServiceProvider> service_provider);
146 148
147 // Removes |node_id| from the set of roots this connection knows about. 149 // Removes |node_id| from the set of roots this connection knows about.
148 void RemoveRoot(const NodeId& node_id); 150 void RemoveRoot(const NodeId& node_id);
149 151
150 void RemoveChildrenAsPartOfEmbed(const NodeId& node_id); 152 void RemoveChildrenAsPartOfEmbed(const NodeId& node_id);
151 153
152 // Converts Node(s) to NodeData(s) for transport. This assumes all the nodes 154 // Converts Node(s) to NodeData(s) for transport. This assumes all the nodes
153 // are valid for the client. The parent of nodes the client is not allowed to 155 // are valid for the client. The parent of nodes the client is not allowed to
154 // see are set to NULL (in the returned NodeData(s)). 156 // see are set to NULL (in the returned NodeData(s)).
155 Array<NodeDataPtr> NodesToNodeDatas(const std::vector<const Node*>& nodes); 157 Array<NodeDataPtr> NodesToNodeDatas(const std::vector<const Node*>& nodes);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 virtual void SetFocus(Id node_id, 193 virtual void SetFocus(Id node_id,
192 const Callback<void(bool)> & callback) OVERRIDE; 194 const Callback<void(bool)> & callback) OVERRIDE;
193 virtual void SetNodeBounds(Id node_id, 195 virtual void SetNodeBounds(Id node_id,
194 RectPtr bounds, 196 RectPtr bounds,
195 const Callback<void(bool)>& callback) OVERRIDE; 197 const Callback<void(bool)>& callback) OVERRIDE;
196 virtual void SetNodeVisibility(Id transport_node_id, 198 virtual void SetNodeVisibility(Id transport_node_id,
197 bool visible, 199 bool visible,
198 const Callback<void(bool)>& callback) OVERRIDE; 200 const Callback<void(bool)>& callback) OVERRIDE;
199 virtual void Embed(const String& url, 201 virtual void Embed(const String& url,
200 Id transport_node_id, 202 Id transport_node_id,
203 ServiceProviderPtr service_provider,
201 const Callback<void(bool)>& callback) OVERRIDE; 204 const Callback<void(bool)>& callback) OVERRIDE;
202 virtual void DispatchOnViewInputEvent(Id transport_view_id, 205 virtual void DispatchOnViewInputEvent(Id transport_view_id,
203 EventPtr event) OVERRIDE; 206 EventPtr event) OVERRIDE;
204 207
205 // InterfaceImpl: 208 // InterfaceImpl:
206 virtual void OnConnectionEstablished() MOJO_OVERRIDE; 209 virtual void OnConnectionEstablished() MOJO_OVERRIDE;
207 210
208 // AccessPolicyDelegate: 211 // AccessPolicyDelegate:
209 virtual const base::hash_set<Id>& GetRootsForAccessPolicy() const OVERRIDE; 212 virtual const base::hash_set<Id>& GetRootsForAccessPolicy() const OVERRIDE;
210 virtual bool IsNodeKnownForAccessPolicy(const Node* node) const OVERRIDE; 213 virtual bool IsNodeKnownForAccessPolicy(const Node* node) const OVERRIDE;
(...skipping 29 matching lines...) Expand all
240 // Embed() is invoked the id of the node is added to this set for the child 243 // Embed() is invoked the id of the node is added to this set for the child
241 // connection. The connection Embed() was invoked on (the parent) doesn't 244 // connection. The connection Embed() was invoked on (the parent) doesn't
242 // directly track which connections are attached to which of its nodes. That 245 // directly track which connections are attached to which of its nodes. That
243 // information can be found by looking through the |roots_| of all 246 // information can be found by looking through the |roots_| of all
244 // connections. 247 // connections.
245 NodeIdSet roots_; 248 NodeIdSet roots_;
246 249
247 // See description above setter. 250 // See description above setter.
248 bool delete_on_connection_error_; 251 bool delete_on_connection_error_;
249 252
253 InterfaceRequest<ServiceProvider> service_provider_;
254
250 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); 255 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl);
251 }; 256 };
252 257
253 #if defined(OS_WIN) 258 #if defined(OS_WIN)
254 #pragma warning(pop) 259 #pragma warning(pop)
255 #endif 260 #endif
256 261
257 } // namespace service 262 } // namespace service
258 } // namespace mojo 263 } // namespace mojo
259 264
260 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ 265 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_init_service_impl.cc ('k') | mojo/services/view_manager/view_manager_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698