| 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_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
| 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // | 27 // |
| 28 // TODO: displays | 28 // TODO: displays |
| 29 class ViewManager { | 29 class ViewManager { |
| 30 public: | 30 public: |
| 31 ~ViewManager(); | 31 ~ViewManager(); |
| 32 | 32 |
| 33 // |ready_callback| is run when the ViewManager connection is established | 33 // |ready_callback| is run when the ViewManager connection is established |
| 34 // and ready to use. | 34 // and ready to use. |
| 35 static void Create( | 35 static void Create( |
| 36 Application* application, | 36 Application* application, |
| 37 const base::Callback<void(ViewManager*)> ready_callback); | 37 const base::Callback<void(ViewManager*)>& root_added_callback); |
| 38 // Blocks until ViewManager is ready to use. | 38 // Blocks until ViewManager is ready to use. |
| 39 static ViewManager* CreateBlocking(Application* application); | 39 static ViewManager* CreateBlocking( |
| 40 Application* application, |
| 41 const base::Callback<void(ViewManager*)>& root_added_callback); |
| 40 | 42 |
| 41 ViewTreeNode* tree() { return tree_; } | 43 const std::vector<ViewTreeNode*>& roots() { return roots_; } |
| 42 | 44 |
| 43 ViewTreeNode* GetNodeById(TransportNodeId id); | 45 ViewTreeNode* GetNodeById(TransportNodeId id); |
| 44 View* GetViewById(TransportViewId id); | 46 View* GetViewById(TransportViewId id); |
| 45 | 47 |
| 46 void Embed(const String& url, ViewTreeNode* node); | |
| 47 | |
| 48 private: | 48 private: |
| 49 friend class ViewManagerPrivate; | 49 friend class ViewManagerPrivate; |
| 50 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; | 50 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; |
| 51 typedef std::map<TransportViewId, View*> IdToViewMap; | 51 typedef std::map<TransportViewId, View*> IdToViewMap; |
| 52 | 52 |
| 53 ViewManager(Application* application, | 53 ViewManager(Application* application, |
| 54 const base::Callback<void(ViewManager*)> ready_callback); | 54 const base::Callback<void(ViewManager*)>& root_added_callback); |
| 55 | 55 |
| 56 base::Callback<void(ViewManager*)> ready_callback_; | 56 base::Callback<void(ViewManager*)> root_added_callback_; |
| 57 | 57 |
| 58 ViewManagerSynchronizer* synchronizer_; | 58 ViewManagerSynchronizer* synchronizer_; |
| 59 ViewTreeNode* tree_; | 59 |
| 60 std::vector<ViewTreeNode*> roots_; |
| 60 | 61 |
| 61 IdToNodeMap nodes_; | 62 IdToNodeMap nodes_; |
| 62 IdToViewMap views_; | 63 IdToViewMap views_; |
| 63 | 64 |
| 64 DISALLOW_COPY_AND_ASSIGN(ViewManager); | 65 DISALLOW_COPY_AND_ASSIGN(ViewManager); |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 } // namespace view_manager | 68 } // namespace view_manager |
| 68 } // namespace mojo | 69 } // namespace mojo |
| 69 | 70 |
| 70 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 71 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
| OLD | NEW |