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