Chromium Code Reviews| Index: mojo/services/public/cpp/view_manager/view_manager.h |
| diff --git a/mojo/services/public/cpp/view_manager/view_manager.h b/mojo/services/public/cpp/view_manager/view_manager.h |
| index 54caf789f7d8c95066d0ffc050371b8ea62463a4..9ab0d2015f8bb6f6ebafc5b8a77a3379c4eccc68 100644 |
| --- a/mojo/services/public/cpp/view_manager/view_manager.h |
| +++ b/mojo/services/public/cpp/view_manager/view_manager.h |
| @@ -21,25 +21,24 @@ class View; |
| class ViewManagerSynchronizer; |
| class ViewTreeNode; |
| +class ViewManagerDelegate { |
|
sky
2014/06/06 20:02:07
nit: move into its own file.
|
| + public: |
| + virtual void OnRootAdded(ViewManager* view_manager, ViewTreeNode* root) {} |
| + virtual void OnRootRemoved(ViewManager* view_manager, ViewTreeNode* root) {} |
| + |
| + protected: |
| + virtual ~ViewManagerDelegate() {} |
| +}; |
| + |
| // Approximately encapsulates the View Manager service. |
| // Has a synchronizer that keeps a client model in sync with the service. |
| // Owned by the connection. |
| -// |
| -// TODO: displays |
| class ViewManager { |
|
Ben Goodger (Google)
2014/06/06 19:55:46
I think that after this change, it may make most s
|
| public: |
| - typedef base::Callback<void(ViewManager*, ViewTreeNode*)> RootCallback; |
| - |
| ~ViewManager(); |
| - // |ready_callback| is run when the ViewManager connection is established |
| - // and ready to use. |
| - static void Create( |
| - Application* application, |
| - const RootCallback& root_added_callback, |
| - const RootCallback& root_removed_callback); |
| - // Blocks until ViewManager is ready to use. |
| - static ViewManager* CreateBlocking(Application* application); |
| + // Delegate is owned by the caller. |
| + static void Create(Application* application, ViewManagerDelegate* delegate); |
| const std::vector<ViewTreeNode*>& roots() { return roots_; } |
| @@ -48,16 +47,17 @@ class ViewManager { |
| private: |
| friend class ViewManagerPrivate; |
| + friend class ViewManagerSynchronizer; |
| + |
| typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; |
| typedef std::map<TransportViewId, View*> IdToViewMap; |
| + typedef std::map<TransportConnectionId, |
| + ViewManagerSynchronizer*> SynchronizerMap; |
| - ViewManager(Application* application, |
| - const RootCallback& root_added_callback, |
| - const RootCallback& root_removed_callback); |
| - |
| - RootCallback root_added_callback_; |
| - RootCallback root_removed_callback_; |
| + ViewManager(ViewManagerSynchronizer* synchronizer, |
| + ViewManagerDelegate* delegate); |
| + ViewManagerDelegate* delegate_; |
| ViewManagerSynchronizer* synchronizer_; |
| std::vector<ViewTreeNode*> roots_; |