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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/observer_list.h" |
| 11 #include "mojo/public/cpp/bindings/callback.h" |
| 12 #include "mojo/services/public/cpp/view_manager/view_tree_node.h" |
10 | 13 |
11 namespace mojo { | 14 namespace mojo { |
12 class Shell; | 15 class Shell; |
13 namespace services { | 16 namespace services { |
14 namespace view_manager { | 17 namespace view_manager { |
15 | 18 |
| 19 class ViewManagerObserver; |
16 class ViewManagerSynchronizer; | 20 class ViewManagerSynchronizer; |
| 21 class ViewTreeNode; |
17 | 22 |
18 // Approximately encapsulates the View Manager service. | 23 // Approximately encapsulates the View Manager service. |
19 // Owns a synchronizer that keeps a client model in sync with the service. | 24 // Owns a synchronizer that keeps a client model in sync with the service. |
20 // Owned by the creator. | 25 // Owned by the creator. |
21 // | 26 // |
22 // TODO: displays | 27 // TODO: displays |
23 class ViewManager { | 28 class ViewManager { |
24 public: | 29 public: |
25 explicit ViewManager(Shell* shell); | 30 explicit ViewManager(Shell* shell); |
26 ~ViewManager(); | 31 ~ViewManager(); |
27 | 32 |
| 33 void BuildNodeTree(const mojo::Callback<void()>& callback); |
| 34 |
| 35 ViewTreeNode* tree() { return tree_.get(); } |
| 36 |
28 private: | 37 private: |
29 friend class ViewManagerPrivate; | 38 friend class ViewManagerPrivate; |
30 | 39 |
| 40 void AddObserver(ViewManagerObserver* observer); |
| 41 void RemoveObserver(ViewManagerObserver* observer); |
| 42 |
31 Shell* shell_; | 43 Shell* shell_; |
32 scoped_ptr<ViewManagerSynchronizer> synchronizer_; | 44 scoped_ptr<ViewManagerSynchronizer> synchronizer_; |
| 45 scoped_ptr<ViewTreeNode> tree_; |
| 46 |
| 47 ObserverList<ViewManagerObserver> observers_; |
33 | 48 |
34 DISALLOW_COPY_AND_ASSIGN(ViewManager); | 49 DISALLOW_COPY_AND_ASSIGN(ViewManager); |
35 }; | 50 }; |
36 | 51 |
37 } // namespace view_manager | 52 } // namespace view_manager |
38 } // namespace services | 53 } // namespace services |
39 } // namespace mojo | 54 } // namespace mojo |
40 | 55 |
41 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ | 56 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_MANAGER_H_ |
OLD | NEW |