| 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" | |
| 11 | 9 |
| 12 namespace mojo { | 10 namespace mojo { |
| 13 namespace services { | 11 namespace services { |
| 14 namespace view_manager { | 12 namespace view_manager { |
| 15 | 13 |
| 16 class ViewManager; | |
| 17 class ViewObserver; | |
| 18 class ViewTreeNode; | |
| 19 | |
| 20 // Views are owned by the ViewManager. | |
| 21 class View { | 14 class View { |
| 22 public: | 15 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 | |
| 33 private: | 16 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 | |
| 48 DISALLOW_COPY_AND_ASSIGN(View); | 17 DISALLOW_COPY_AND_ASSIGN(View); |
| 49 }; | 18 }; |
| 50 | 19 |
| 51 } // namespace view_manager | 20 } // namespace view_manager |
| 52 } // namespace services | 21 } // namespace services |
| 53 } // namespace mojo | 22 } // namespace mojo |
| 54 | 23 |
| 55 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ | 24 #endif // MOJO_SERVICES_PUBLIC_CPP_VIEW_MANAGER_VIEW_H_ |
| OLD | NEW |