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