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_H_ | 5 #ifndef MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ | 6 #define MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list.h" |
| 10 #include "mojo/services/public/cpp/view_manager/view_manager_types.h" |
9 | 11 |
10 namespace mojo { | 12 namespace mojo { |
11 namespace services { | 13 namespace services { |
12 namespace view_manager { | 14 namespace view_manager { |
13 | 15 |
| 16 class ViewManager; |
| 17 class ViewObserver; |
| 18 class ViewTreeNode; |
| 19 |
| 20 // Views are owned by the ViewManager. |
14 class View { | 21 class View { |
15 public: | 22 public: |
| 23 static View* Create(ViewManager* manager); |
| 24 |
| 25 void Destroy(); |
| 26 |
| 27 TransportViewId id() const { return id_; } |
| 28 ViewTreeNode* node() { return node_; } |
| 29 |
| 30 void AddObserver(ViewObserver* observer); |
| 31 void RemoveObserver(ViewObserver* observer); |
| 32 |
16 private: | 33 private: |
| 34 friend class ViewPrivate; |
| 35 |
| 36 explicit View(ViewManager* manager); |
| 37 View(); |
| 38 ~View(); |
| 39 |
| 40 void LocalDestroy(); |
| 41 |
| 42 TransportViewId id_; |
| 43 ViewTreeNode* node_; |
| 44 ViewManager* manager_; |
| 45 |
| 46 ObserverList<ViewObserver> observers_; |
| 47 |
17 DISALLOW_COPY_AND_ASSIGN(View); | 48 DISALLOW_COPY_AND_ASSIGN(View); |
18 }; | 49 }; |
19 | 50 |
20 } // namespace view_manager | 51 } // namespace view_manager |
21 } // namespace services | 52 } // namespace services |
22 } // namespace mojo | 53 } // namespace mojo |
23 | 54 |
24 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ | 55 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
OLD | NEW |