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