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> |
| 9 |
8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "mojo/public/cpp/bindings/callback.h" | 12 #include "mojo/public/cpp/bindings/callback.h" |
11 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" | 13 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
12 | 14 |
13 namespace mojo { | 15 namespace mojo { |
14 class Shell; | 16 class Shell; |
15 namespace services { | 17 namespace services { |
16 namespace view_manager { | 18 namespace view_manager { |
17 | 19 |
(...skipping 14 matching lines...) Expand all Loading... |
32 // using any other View Manager lib class or function. | 34 // using any other View Manager lib class or function. |
33 // Blocks on establishing the connection and subsequently receiving a node | 35 // Blocks on establishing the connection and subsequently receiving a node |
34 // tree from the service. | 36 // tree from the service. |
35 // TODO(beng): blocking is currently achieved by running a nested runloop, | 37 // TODO(beng): blocking is currently achieved by running a nested runloop, |
36 // which will dispatch all messages on all pipes while blocking. | 38 // which will dispatch all messages on all pipes while blocking. |
37 // we should instead wait on the client pipe receiving a | 39 // we should instead wait on the client pipe receiving a |
38 // connection established message. | 40 // connection established message. |
39 // TODO(beng): this method could optionally not block if supplied a callback. | 41 // TODO(beng): this method could optionally not block if supplied a callback. |
40 void Init(); | 42 void Init(); |
41 | 43 |
42 ViewTreeNode* tree() { return tree_.get(); } | 44 ViewTreeNode* tree() { return tree_; } |
| 45 |
| 46 ViewTreeNode* GetNodeById(TransportNodeId id); |
43 | 47 |
44 private: | 48 private: |
45 friend class ViewManagerPrivate; | 49 friend class ViewManagerPrivate; |
| 50 typedef std::map<TransportNodeId, ViewTreeNode*> IdToNodeMap; |
46 | 51 |
47 Shell* shell_; | 52 Shell* shell_; |
48 scoped_ptr<ViewManagerSynchronizer> synchronizer_; | 53 scoped_ptr<ViewManagerSynchronizer> synchronizer_; |
49 scoped_ptr<ViewTreeNode> tree_; | 54 ViewTreeNode* tree_; |
| 55 |
| 56 IdToNodeMap nodes_; |
50 | 57 |
51 DISALLOW_COPY_AND_ASSIGN(ViewManager); | 58 DISALLOW_COPY_AND_ASSIGN(ViewManager); |
52 }; | 59 }; |
53 | 60 |
54 } // namespace view_manager | 61 } // namespace view_manager |
55 } // namespace services | 62 } // namespace services |
56 } // namespace mojo | 63 } // namespace mojo |
57 | 64 |
58 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 65 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
OLD | NEW |