| 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 25 matching lines...) Expand all Loading... |
| 36 public: | 36 public: |
| 37 using ViewIdSet = base::hash_set<mojo::Id>; | 37 using ViewIdSet = base::hash_set<mojo::Id>; |
| 38 | 38 |
| 39 ViewManagerServiceImpl(ConnectionManager* connection_manager, | 39 ViewManagerServiceImpl(ConnectionManager* connection_manager, |
| 40 mojo::ConnectionSpecificId creator_id, | 40 mojo::ConnectionSpecificId creator_id, |
| 41 const std::string& creator_url, | 41 const std::string& creator_url, |
| 42 const std::string& url, | 42 const std::string& url, |
| 43 const ViewId& root_id); | 43 const ViewId& root_id); |
| 44 ~ViewManagerServiceImpl() override; | 44 ~ViewManagerServiceImpl() override; |
| 45 | 45 |
| 46 // |service_provider| is the ServiceProvider to pass to the client via | 46 // |services| and |exposed_services| are the ServiceProviders to pass to the |
| 47 // OnEmbed(). | 47 // client via OnEmbed(). |
| 48 void Init(mojo::ViewManagerClient* client, | 48 void Init(mojo::ViewManagerClient* client, |
| 49 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider); | 49 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 50 mojo::ServiceProviderPtr exposed_services); |
| 50 | 51 |
| 51 mojo::ConnectionSpecificId id() const { return id_; } | 52 mojo::ConnectionSpecificId id() const { return id_; } |
| 52 mojo::ConnectionSpecificId creator_id() const { return creator_id_; } | 53 mojo::ConnectionSpecificId creator_id() const { return creator_id_; } |
| 53 const std::string& url() const { return url_; } | 54 const std::string& url() const { return url_; } |
| 54 | 55 |
| 55 mojo::ViewManagerClient* client() { return client_; } | 56 mojo::ViewManagerClient* client() { return client_; } |
| 56 | 57 |
| 57 // Returns the View with the specified id. | 58 // Returns the View with the specified id. |
| 58 ServerView* GetView(const ViewId& id) { | 59 ServerView* GetView(const ViewId& id) { |
| 59 return const_cast<ServerView*>( | 60 return const_cast<ServerView*>( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 73 | 74 |
| 74 // These functions are synchronous variants of those defined in the mojom. The | 75 // These functions are synchronous variants of those defined in the mojom. The |
| 75 // ViewManagerService implementations all call into these. See the mojom for | 76 // ViewManagerService implementations all call into these. See the mojom for |
| 76 // details. | 77 // details. |
| 77 mojo::ErrorCode CreateView(const ViewId& view_id); | 78 mojo::ErrorCode CreateView(const ViewId& view_id); |
| 78 bool AddView(const ViewId& parent_id, const ViewId& child_id); | 79 bool AddView(const ViewId& parent_id, const ViewId& child_id); |
| 79 std::vector<const ServerView*> GetViewTree(const ViewId& view_id) const; | 80 std::vector<const ServerView*> GetViewTree(const ViewId& view_id) const; |
| 80 bool SetViewVisibility(const ViewId& view_id, bool visible); | 81 bool SetViewVisibility(const ViewId& view_id, bool visible); |
| 81 bool Embed(const std::string& url, | 82 bool Embed(const std::string& url, |
| 82 const ViewId& view_id, | 83 const ViewId& view_id, |
| 83 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider); | 84 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 85 mojo::ServiceProviderPtr exposed_services); |
| 84 | 86 |
| 85 // The following methods are invoked after the corresponding change has been | 87 // The following methods are invoked after the corresponding change has been |
| 86 // processed. They do the appropriate bookkeeping and update the client as | 88 // processed. They do the appropriate bookkeeping and update the client as |
| 87 // necessary. | 89 // necessary. |
| 88 void ProcessViewBoundsChanged(const ServerView* view, | 90 void ProcessViewBoundsChanged(const ServerView* view, |
| 89 const gfx::Rect& old_bounds, | 91 const gfx::Rect& old_bounds, |
| 90 const gfx::Rect& new_bounds, | 92 const gfx::Rect& new_bounds, |
| 91 bool originated_change); | 93 bool originated_change); |
| 92 void ProcessWillChangeViewHierarchy(const ServerView* view, | 94 void ProcessWillChangeViewHierarchy(const ServerView* view, |
| 93 const ServerView* new_parent, | 95 const ServerView* new_parent, |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 const mojo::Callback<void(bool)>& callback) override; | 190 const mojo::Callback<void(bool)>& callback) override; |
| 189 void SetViewVisibility(mojo::Id view_id, | 191 void SetViewVisibility(mojo::Id view_id, |
| 190 bool visible, | 192 bool visible, |
| 191 const mojo::Callback<void(bool)>& callback) override; | 193 const mojo::Callback<void(bool)>& callback) override; |
| 192 void SetViewProperty(mojo::Id view_id, | 194 void SetViewProperty(mojo::Id view_id, |
| 193 const mojo::String& name, | 195 const mojo::String& name, |
| 194 mojo::Array<uint8_t> value, | 196 mojo::Array<uint8_t> value, |
| 195 const mojo::Callback<void(bool)>& callback) override; | 197 const mojo::Callback<void(bool)>& callback) override; |
| 196 void Embed(const mojo::String& url, | 198 void Embed(const mojo::String& url, |
| 197 mojo::Id view_id, | 199 mojo::Id view_id, |
| 198 mojo::InterfaceRequest<mojo::ServiceProvider> service_provider, | 200 mojo::InterfaceRequest<mojo::ServiceProvider> services, |
| 201 mojo::ServiceProviderPtr exposed_services, |
| 199 const mojo::Callback<void(bool)>& callback) override; | 202 const mojo::Callback<void(bool)>& callback) override; |
| 200 | 203 |
| 201 // AccessPolicyDelegate: | 204 // AccessPolicyDelegate: |
| 202 bool IsRootForAccessPolicy(const ViewId& id) const override; | 205 bool IsRootForAccessPolicy(const ViewId& id) const override; |
| 203 bool IsViewKnownForAccessPolicy(const ServerView* view) const override; | 206 bool IsViewKnownForAccessPolicy(const ServerView* view) const override; |
| 204 bool IsViewRootOfAnotherConnectionForAccessPolicy( | 207 bool IsViewRootOfAnotherConnectionForAccessPolicy( |
| 205 const ServerView* view) const override; | 208 const ServerView* view) const override; |
| 206 | 209 |
| 207 ConnectionManager* connection_manager_; | 210 ConnectionManager* connection_manager_; |
| 208 | 211 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 233 // connection may have no root. A connection has no root if either the root | 236 // connection may have no root. A connection has no root if either the root |
| 234 // is destroyed or Embed() is invoked on the root. | 237 // is destroyed or Embed() is invoked on the root. |
| 235 scoped_ptr<ViewId> root_; | 238 scoped_ptr<ViewId> root_; |
| 236 | 239 |
| 237 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); | 240 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); |
| 238 }; | 241 }; |
| 239 | 242 |
| 240 } // namespace view_manager | 243 } // namespace view_manager |
| 241 | 244 |
| 242 #endif // SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 245 #endif // SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| OLD | NEW |