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_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 29 matching lines...) Expand all Loading... |
40 class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl | 40 class MOJO_VIEW_MANAGER_EXPORT ViewManagerServiceImpl |
41 : public InterfaceImpl<ViewManagerService>, | 41 : public InterfaceImpl<ViewManagerService>, |
42 public AccessPolicyDelegate { | 42 public AccessPolicyDelegate { |
43 public: | 43 public: |
44 ViewManagerServiceImpl(ConnectionManager* connection_manager, | 44 ViewManagerServiceImpl(ConnectionManager* connection_manager, |
45 ConnectionSpecificId creator_id, | 45 ConnectionSpecificId creator_id, |
46 const std::string& creator_url, | 46 const std::string& creator_url, |
47 const std::string& url, | 47 const std::string& url, |
48 const ViewId& root_id, | 48 const ViewId& root_id, |
49 InterfaceRequest<ServiceProvider> service_provider); | 49 InterfaceRequest<ServiceProvider> service_provider); |
50 virtual ~ViewManagerServiceImpl(); | 50 ~ViewManagerServiceImpl() override; |
51 | 51 |
52 // Used to mark this connection as originating from a call to | 52 // Used to mark this connection as originating from a call to |
53 // ViewManagerService::Connect(). When set OnConnectionError() deletes |this|. | 53 // ViewManagerService::Connect(). When set OnConnectionError() deletes |this|. |
54 void set_delete_on_connection_error() { delete_on_connection_error_ = true; } | 54 void set_delete_on_connection_error() { delete_on_connection_error_ = true; } |
55 | 55 |
56 ConnectionSpecificId id() const { return id_; } | 56 ConnectionSpecificId id() const { return id_; } |
57 ConnectionSpecificId creator_id() const { return creator_id_; } | 57 ConnectionSpecificId creator_id() const { return creator_id_; } |
58 const std::string& url() const { return url_; } | 58 const std::string& url() const { return url_; } |
59 | 59 |
60 // Returns the View with the specified id. | 60 // Returns the View with the specified id. |
(...skipping 28 matching lines...) Expand all Loading... |
89 const ServerView* relative_view, | 89 const ServerView* relative_view, |
90 OrderDirection direction, | 90 OrderDirection direction, |
91 bool originated_change); | 91 bool originated_change); |
92 void ProcessViewDeleted(const ViewId& view, bool originated_change); | 92 void ProcessViewDeleted(const ViewId& view, bool originated_change); |
93 void ProcessWillChangeViewVisibility(const ServerView* view, | 93 void ProcessWillChangeViewVisibility(const ServerView* view, |
94 bool originated_change); | 94 bool originated_change); |
95 | 95 |
96 // TODO(sky): move this to private section (currently can't because of | 96 // TODO(sky): move this to private section (currently can't because of |
97 // bindings). | 97 // bindings). |
98 // InterfaceImp overrides: | 98 // InterfaceImp overrides: |
99 virtual void OnConnectionError() override; | 99 void OnConnectionError() override; |
100 | 100 |
101 private: | 101 private: |
102 typedef std::map<ConnectionSpecificId, ServerView*> ViewMap; | 102 typedef std::map<ConnectionSpecificId, ServerView*> ViewMap; |
103 typedef base::hash_set<Id> ViewIdSet; | 103 typedef base::hash_set<Id> ViewIdSet; |
104 | 104 |
105 bool IsViewKnown(const ServerView* view) const; | 105 bool IsViewKnown(const ServerView* view) const; |
106 | 106 |
107 // These functions return true if the corresponding mojom function is allowed | 107 // These functions return true if the corresponding mojom function is allowed |
108 // for this connection. | 108 // for this connection. |
109 bool CanReorderView(const ServerView* view, | 109 bool CanReorderView(const ServerView* view, |
(...skipping 30 matching lines...) Expand all Loading... |
140 // Implementation of GetViewTree(). Adds |view| to |views| and recurses if | 140 // Implementation of GetViewTree(). Adds |view| to |views| and recurses if |
141 // CanDescendIntoViewForViewTree() returns true. | 141 // CanDescendIntoViewForViewTree() returns true. |
142 void GetViewTreeImpl(const ServerView* view, | 142 void GetViewTreeImpl(const ServerView* view, |
143 std::vector<const ServerView*>* views) const; | 143 std::vector<const ServerView*>* views) const; |
144 | 144 |
145 // Notify the client if the drawn state of any of the roots changes. | 145 // Notify the client if the drawn state of any of the roots changes. |
146 // |view| is the view that is changing to the drawn state |new_drawn_value|. | 146 // |view| is the view that is changing to the drawn state |new_drawn_value|. |
147 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); | 147 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); |
148 | 148 |
149 // ViewManagerService: | 149 // ViewManagerService: |
150 virtual void CreateView(Id transport_view_id, | 150 void CreateView(Id transport_view_id, |
151 const Callback<void(ErrorCode)>& callback) override; | 151 const Callback<void(ErrorCode)>& callback) override; |
152 virtual void DeleteView(Id transport_view_id, | 152 void DeleteView(Id transport_view_id, |
153 const Callback<void(bool)>& callback) override; | 153 const Callback<void(bool)>& callback) override; |
154 virtual void AddView(Id parent_id, | 154 void AddView(Id parent_id, |
155 Id child_id, | 155 Id child_id, |
156 const Callback<void(bool)>& callback) override; | 156 const Callback<void(bool)>& callback) override; |
157 virtual void RemoveViewFromParent( | 157 void RemoveViewFromParent(Id view_id, |
158 Id view_id, | 158 const Callback<void(bool)>& callback) override; |
159 const Callback<void(bool)>& callback) override; | 159 void ReorderView(Id view_id, |
160 virtual void ReorderView(Id view_id, | 160 Id relative_view_id, |
161 Id relative_view_id, | 161 OrderDirection direction, |
162 OrderDirection direction, | 162 const Callback<void(bool)>& callback) override; |
163 const Callback<void(bool)>& callback) override; | 163 void GetViewTree(Id view_id, |
164 virtual void GetViewTree( | 164 const Callback<void(Array<ViewDataPtr>)>& callback) override; |
165 Id view_id, | 165 void SetViewSurfaceId(Id view_id, |
166 const Callback<void(Array<ViewDataPtr>)>& callback) override; | 166 SurfaceIdPtr surface_id, |
167 virtual void SetViewSurfaceId(Id view_id, | 167 const Callback<void(bool)>& callback) override; |
168 SurfaceIdPtr surface_id, | 168 void SetViewBounds(Id view_id, |
169 const Callback<void(bool)>& callback) override; | 169 RectPtr bounds, |
170 virtual void SetViewBounds(Id view_id, | |
171 RectPtr bounds, | |
172 const Callback<void(bool)>& callback) override; | |
173 virtual void SetViewVisibility(Id view_id, | |
174 bool visible, | |
175 const Callback<void(bool)>& callback) override; | |
176 virtual void Embed(const String& url, | |
177 Id view_id, | |
178 ServiceProviderPtr service_provider, | |
179 const Callback<void(bool)>& callback) override; | 170 const Callback<void(bool)>& callback) override; |
| 171 void SetViewVisibility(Id view_id, |
| 172 bool visible, |
| 173 const Callback<void(bool)>& callback) override; |
| 174 void Embed(const String& url, |
| 175 Id view_id, |
| 176 ServiceProviderPtr service_provider, |
| 177 const Callback<void(bool)>& callback) override; |
180 | 178 |
181 // InterfaceImpl: | 179 // InterfaceImpl: |
182 virtual void OnConnectionEstablished() override; | 180 void OnConnectionEstablished() override; |
183 | 181 |
184 // AccessPolicyDelegate: | 182 // AccessPolicyDelegate: |
185 virtual const base::hash_set<Id>& GetRootsForAccessPolicy() const override; | 183 const base::hash_set<Id>& GetRootsForAccessPolicy() const override; |
186 virtual bool IsViewKnownForAccessPolicy( | 184 bool IsViewKnownForAccessPolicy(const ServerView* view) const override; |
187 const ServerView* view) const override; | 185 bool IsViewRootOfAnotherConnectionForAccessPolicy( |
188 virtual bool IsViewRootOfAnotherConnectionForAccessPolicy( | |
189 const ServerView* view) const override; | 186 const ServerView* view) const override; |
190 | 187 |
191 ConnectionManager* connection_manager_; | 188 ConnectionManager* connection_manager_; |
192 | 189 |
193 // Id of this connection as assigned by ConnectionManager. | 190 // Id of this connection as assigned by ConnectionManager. |
194 const ConnectionSpecificId id_; | 191 const ConnectionSpecificId id_; |
195 | 192 |
196 // URL this connection was created for. | 193 // URL this connection was created for. |
197 const std::string url_; | 194 const std::string url_; |
198 | 195 |
(...skipping 30 matching lines...) Expand all Loading... |
229 }; | 226 }; |
230 | 227 |
231 #if defined(OS_WIN) | 228 #if defined(OS_WIN) |
232 #pragma warning(pop) | 229 #pragma warning(pop) |
233 #endif | 230 #endif |
234 | 231 |
235 } // namespace service | 232 } // namespace service |
236 } // namespace mojo | 233 } // namespace mojo |
237 | 234 |
238 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 235 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
OLD | NEW |