| 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 SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 5 #ifndef SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| 6 #define SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 6 #define 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Invoked when a connection is about to be destroyed. | 73 // Invoked when a connection is about to be destroyed. |
| 74 void OnWillDestroyViewManagerServiceImpl(ViewManagerServiceImpl* connection); | 74 void OnWillDestroyViewManagerServiceImpl(ViewManagerServiceImpl* connection); |
| 75 | 75 |
| 76 // These functions are synchronous variants of those defined in the mojom. The | 76 // These functions are synchronous variants of those defined in the mojom. The |
| 77 // ViewManagerService implementations all call into these. See the mojom for | 77 // ViewManagerService implementations all call into these. See the mojom for |
| 78 // details. | 78 // details. |
| 79 mojo::ErrorCode CreateView(const ViewId& view_id); | 79 mojo::ErrorCode CreateView(const ViewId& view_id); |
| 80 bool AddView(const ViewId& parent_id, const ViewId& child_id); | 80 bool AddView(const ViewId& parent_id, const ViewId& child_id); |
| 81 std::vector<const ServerView*> GetViewTree(const ViewId& view_id) const; | 81 std::vector<const ServerView*> GetViewTree(const ViewId& view_id) const; |
| 82 bool SetViewVisibility(const ViewId& view_id, bool visible); | 82 bool SetViewVisibility(const ViewId& view_id, bool visible); |
| 83 bool Embed(const std::string& url, | 83 bool EmbedUrl(const std::string& url, |
| 84 const ViewId& view_id, | 84 const ViewId& view_id, |
| 85 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 85 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 86 mojo::ServiceProviderPtr exposed_services); | 86 mojo::ServiceProviderPtr exposed_services); |
| 87 bool Embed(const ViewId& view_id, mojo::ViewManagerClientPtr client); |
| 87 | 88 |
| 88 // The following methods are invoked after the corresponding change has been | 89 // The following methods are invoked after the corresponding change has been |
| 89 // processed. They do the appropriate bookkeeping and update the client as | 90 // processed. They do the appropriate bookkeeping and update the client as |
| 90 // necessary. | 91 // necessary. |
| 91 void ProcessViewBoundsChanged(const ServerView* view, | 92 void ProcessViewBoundsChanged(const ServerView* view, |
| 92 const gfx::Rect& old_bounds, | 93 const gfx::Rect& old_bounds, |
| 93 const gfx::Rect& new_bounds, | 94 const gfx::Rect& new_bounds, |
| 94 bool originated_change); | 95 bool originated_change); |
| 95 void ProcessViewportMetricsChanged(const mojo::ViewportMetrics& old_metrics, | 96 void ProcessViewportMetricsChanged(const mojo::ViewportMetrics& old_metrics, |
| 96 const mojo::ViewportMetrics& new_metrics, | 97 const mojo::ViewportMetrics& new_metrics, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void GetViewTreeImpl(const ServerView* view, | 161 void GetViewTreeImpl(const ServerView* view, |
| 161 std::vector<const ServerView*>* views) const; | 162 std::vector<const ServerView*>* views) const; |
| 162 | 163 |
| 163 // Notify the client if the drawn state of any of the roots changes. | 164 // Notify the client if the drawn state of any of the roots changes. |
| 164 // |view| is the view that is changing to the drawn state |new_drawn_value|. | 165 // |view| is the view that is changing to the drawn state |new_drawn_value|. |
| 165 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); | 166 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); |
| 166 | 167 |
| 167 // Deletes all Views we own. | 168 // Deletes all Views we own. |
| 168 void DestroyViews(); | 169 void DestroyViews(); |
| 169 | 170 |
| 171 bool PrepareForEmbed(const ViewId& view_id); |
| 172 |
| 170 // ViewManagerService: | 173 // ViewManagerService: |
| 171 void CreateView( | 174 void CreateView( |
| 172 mojo::Id transport_view_id, | 175 mojo::Id transport_view_id, |
| 173 const mojo::Callback<void(mojo::ErrorCode)>& callback) override; | 176 const mojo::Callback<void(mojo::ErrorCode)>& callback) override; |
| 174 void DeleteView(mojo::Id transport_view_id, | 177 void DeleteView(mojo::Id transport_view_id, |
| 175 const mojo::Callback<void(bool)>& callback) override; | 178 const mojo::Callback<void(bool)>& callback) override; |
| 176 void AddView(mojo::Id parent_id, | 179 void AddView(mojo::Id parent_id, |
| 177 mojo::Id child_id, | 180 mojo::Id child_id, |
| 178 const mojo::Callback<void(bool)>& callback) override; | 181 const mojo::Callback<void(bool)>& callback) override; |
| 179 void RemoveViewFromParent( | 182 void RemoveViewFromParent( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 192 void SetViewBounds(mojo::Id view_id, | 195 void SetViewBounds(mojo::Id view_id, |
| 193 mojo::RectPtr bounds, | 196 mojo::RectPtr bounds, |
| 194 const mojo::Callback<void(bool)>& callback) override; | 197 const mojo::Callback<void(bool)>& callback) override; |
| 195 void SetViewVisibility(mojo::Id view_id, | 198 void SetViewVisibility(mojo::Id view_id, |
| 196 bool visible, | 199 bool visible, |
| 197 const mojo::Callback<void(bool)>& callback) override; | 200 const mojo::Callback<void(bool)>& callback) override; |
| 198 void SetViewProperty(mojo::Id view_id, | 201 void SetViewProperty(mojo::Id view_id, |
| 199 const mojo::String& name, | 202 const mojo::String& name, |
| 200 mojo::Array<uint8_t> value, | 203 mojo::Array<uint8_t> value, |
| 201 const mojo::Callback<void(bool)>& callback) override; | 204 const mojo::Callback<void(bool)>& callback) override; |
| 202 void Embed(const mojo::String& url, | 205 void EmbedUrl(const mojo::String& url, |
| 203 mojo::Id view_id, | 206 mojo::Id transport_view_id, |
| 204 mojo::InterfaceRequest<mojo::ServiceProvider> services, | 207 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 205 mojo::ServiceProviderPtr exposed_services, | 208 mojo::ServiceProviderPtr exposed_services, |
| 209 const mojo::Callback<void(bool)>& callback) override; |
| 210 void Embed(mojo::Id transport_view_id, |
| 211 mojo::ViewManagerClientPtr client, |
| 206 const mojo::Callback<void(bool)>& callback) override; | 212 const mojo::Callback<void(bool)>& callback) override; |
| 207 | 213 |
| 208 // AccessPolicyDelegate: | 214 // AccessPolicyDelegate: |
| 209 bool IsRootForAccessPolicy(const ViewId& id) const override; | 215 bool IsRootForAccessPolicy(const ViewId& id) const override; |
| 210 bool IsViewKnownForAccessPolicy(const ServerView* view) const override; | 216 bool IsViewKnownForAccessPolicy(const ServerView* view) const override; |
| 211 bool IsViewRootOfAnotherConnectionForAccessPolicy( | 217 bool IsViewRootOfAnotherConnectionForAccessPolicy( |
| 212 const ServerView* view) const override; | 218 const ServerView* view) const override; |
| 213 | 219 |
| 214 ConnectionManager* connection_manager_; | 220 ConnectionManager* connection_manager_; |
| 215 | 221 |
| 216 // Id of this connection as assigned by ConnectionManager. | 222 // Id of this connection as assigned by ConnectionManager. |
| 217 const mojo::ConnectionSpecificId id_; | 223 const mojo::ConnectionSpecificId id_; |
| 218 | 224 |
| 219 // URL this connection was created for. | 225 // URL this connection was created for. |
| 220 const std::string url_; | 226 const std::string url_; |
| 221 | 227 |
| 222 // ID of the connection that created us. If 0 it indicates either we were | 228 // ID of the connection that created us. If 0 it indicates either we were |
| 223 // created by the root, or the connection that created us has been destroyed. | 229 // created by the root, or the connection that created us has been destroyed. |
| 224 mojo::ConnectionSpecificId creator_id_; | 230 mojo::ConnectionSpecificId creator_id_; |
| 225 | 231 |
| 226 // The URL of the app that embedded the app this connection was created for. | 232 // The URL of the app that embedded the app this connection was created for. |
| 233 // NOTE: this is empty if the connection was created by way of directly |
| 234 // supplying the ViewManagerClient. |
| 227 const std::string creator_url_; | 235 const std::string creator_url_; |
| 228 | 236 |
| 229 mojo::ViewManagerClient* client_; | 237 mojo::ViewManagerClient* client_; |
| 230 | 238 |
| 231 scoped_ptr<AccessPolicy> access_policy_; | 239 scoped_ptr<AccessPolicy> access_policy_; |
| 232 | 240 |
| 233 // The views created by this connection. This connection owns these objects. | 241 // The views created by this connection. This connection owns these objects. |
| 234 ViewMap view_map_; | 242 ViewMap view_map_; |
| 235 | 243 |
| 236 // The set of views that has been communicated to the client. | 244 // The set of views that has been communicated to the client. |
| 237 ViewIdSet known_views_; | 245 ViewIdSet known_views_; |
| 238 | 246 |
| 239 // The root of this connection. This is a scoped_ptr to reinforce the | 247 // The root of this connection. This is a scoped_ptr to reinforce the |
| 240 // connection may have no root. A connection has no root if either the root | 248 // connection may have no root. A connection has no root if either the root |
| 241 // is destroyed or Embed() is invoked on the root. | 249 // is destroyed or Embed() is invoked on the root. |
| 242 scoped_ptr<ViewId> root_; | 250 scoped_ptr<ViewId> root_; |
| 243 | 251 |
| 244 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); | 252 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); |
| 245 }; | 253 }; |
| 246 | 254 |
| 247 } // namespace view_manager | 255 } // namespace view_manager |
| 248 | 256 |
| 249 #endif // SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 257 #endif // SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| OLD | NEW |