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