| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 ~ViewManagerServiceImpl() override; | 50 ~ViewManagerServiceImpl() override; |
| 51 | 51 |
| 52 // Used to mark this connection as originating from a call to | |
| 53 // ViewManagerService::Connect(). When set OnConnectionError() deletes |this|. | |
| 54 void set_delete_on_connection_error() { delete_on_connection_error_ = true; } | |
| 55 | |
| 56 ConnectionSpecificId id() const { return id_; } | 52 ConnectionSpecificId id() const { return id_; } |
| 57 ConnectionSpecificId creator_id() const { return creator_id_; } | 53 ConnectionSpecificId creator_id() const { return creator_id_; } |
| 58 const std::string& url() const { return url_; } | 54 const std::string& url() const { return url_; } |
| 59 | 55 |
| 60 // Returns the View with the specified id. | 56 // Returns the View with the specified id. |
| 61 ServerView* GetView(const ViewId& id) { | 57 ServerView* GetView(const ViewId& id) { |
| 62 return const_cast<ServerView*>( | 58 return const_cast<ServerView*>( |
| 63 const_cast<const ViewManagerServiceImpl*>(this)->GetView(id)); | 59 const_cast<const ViewManagerServiceImpl*>(this)->GetView(id)); |
| 64 } | 60 } |
| 65 const ServerView* GetView(const ViewId& id) const; | 61 const ServerView* GetView(const ViewId& id) const; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 141 |
| 146 // Implementation of GetViewTree(). Adds |view| to |views| and recurses if | 142 // Implementation of GetViewTree(). Adds |view| to |views| and recurses if |
| 147 // CanDescendIntoViewForViewTree() returns true. | 143 // CanDescendIntoViewForViewTree() returns true. |
| 148 void GetViewTreeImpl(const ServerView* view, | 144 void GetViewTreeImpl(const ServerView* view, |
| 149 std::vector<const ServerView*>* views) const; | 145 std::vector<const ServerView*>* views) const; |
| 150 | 146 |
| 151 // Notify the client if the drawn state of any of the roots changes. | 147 // Notify the client if the drawn state of any of the roots changes. |
| 152 // |view| is the view that is changing to the drawn state |new_drawn_value|. | 148 // |view| is the view that is changing to the drawn state |new_drawn_value|. |
| 153 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); | 149 void NotifyDrawnStateChanged(const ServerView* view, bool new_drawn_value); |
| 154 | 150 |
| 151 // Deletes all Views we own. |
| 152 void DestroyViews(); |
| 153 |
| 155 // ViewManagerService: | 154 // ViewManagerService: |
| 156 void CreateView(Id transport_view_id, | 155 void CreateView(Id transport_view_id, |
| 157 const Callback<void(ErrorCode)>& callback) override; | 156 const Callback<void(ErrorCode)>& callback) override; |
| 158 void DeleteView(Id transport_view_id, | 157 void DeleteView(Id transport_view_id, |
| 159 const Callback<void(bool)>& callback) override; | 158 const Callback<void(bool)>& callback) override; |
| 160 void AddView(Id parent_id, | 159 void AddView(Id parent_id, |
| 161 Id child_id, | 160 Id child_id, |
| 162 const Callback<void(bool)>& callback) override; | 161 const Callback<void(bool)>& callback) override; |
| 163 void RemoveViewFromParent(Id view_id, | 162 void RemoveViewFromParent(Id view_id, |
| 164 const Callback<void(bool)>& callback) override; | 163 const Callback<void(bool)>& callback) override; |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 ViewIdSet known_views_; | 219 ViewIdSet known_views_; |
| 221 | 220 |
| 222 // Set of root views from other connections. More specifically any time | 221 // Set of root views from other connections. More specifically any time |
| 223 // Embed() is invoked the id of the view is added to this set for the child | 222 // Embed() is invoked the id of the view is added to this set for the child |
| 224 // connection. The connection Embed() was invoked on (the parent) doesn't | 223 // connection. The connection Embed() was invoked on (the parent) doesn't |
| 225 // directly track which connections are attached to which of its views. That | 224 // directly track which connections are attached to which of its views. That |
| 226 // information can be found by looking through the |roots_| of all | 225 // information can be found by looking through the |roots_| of all |
| 227 // connections. | 226 // connections. |
| 228 ViewIdSet roots_; | 227 ViewIdSet roots_; |
| 229 | 228 |
| 230 // See description above setter. | |
| 231 bool delete_on_connection_error_; | |
| 232 | |
| 233 InterfaceRequest<ServiceProvider> service_provider_; | 229 InterfaceRequest<ServiceProvider> service_provider_; |
| 234 | 230 |
| 235 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); | 231 DISALLOW_COPY_AND_ASSIGN(ViewManagerServiceImpl); |
| 236 }; | 232 }; |
| 237 | 233 |
| 238 #if defined(OS_WIN) | 234 #if defined(OS_WIN) |
| 239 #pragma warning(pop) | 235 #pragma warning(pop) |
| 240 #endif | 236 #endif |
| 241 | 237 |
| 242 } // namespace service | 238 } // namespace service |
| 243 } // namespace mojo | 239 } // namespace mojo |
| 244 | 240 |
| 245 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ | 241 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_MANAGER_SERVICE_IMPL_H_ |
| OLD | NEW |