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_VIEW_MANAGER_VIEW_H_ | 5 #ifndef MOJO_SERVICES_VIEW_MANAGER_VIEW_H_ |
6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_H_ | 6 #define MOJO_SERVICES_VIEW_MANAGER_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "mojo/services/view_manager/ids.h" | 11 #include "mojo/services/view_manager/ids.h" |
12 #include "mojo/services/view_manager/view_manager_export.h" | 12 #include "mojo/services/view_manager/view_manager_export.h" |
13 #include "third_party/skia/include/core/SkBitmap.h" | |
14 | 13 |
15 namespace mojo { | 14 namespace mojo { |
16 namespace services { | 15 namespace services { |
17 namespace view_manager { | 16 namespace view_manager { |
18 | 17 |
19 class Node; | 18 class Node; |
20 | 19 |
21 // Represents a view. A view may be associated with a single Node. | 20 // Represents a view. A view may be associated with a single Node. |
22 class MOJO_VIEW_MANAGER_EXPORT View { | 21 class MOJO_VIEW_MANAGER_EXPORT View { |
23 public: | 22 public: |
24 explicit View(const ViewId& id); | 23 explicit View(const ViewId& id); |
25 ~View(); | 24 ~View(); |
26 | 25 |
27 const ViewId& id() const { return id_; } | 26 const ViewId& id() const { return id_; } |
28 | 27 |
29 Node* node() { return node_; } | 28 Node* node() { return node_; } |
30 | 29 |
31 void SetBitmap(const SkBitmap& contents); | |
32 const SkBitmap& bitmap() const { return bitmap_; } | |
33 | |
34 private: | 30 private: |
35 // Node is responsible for maintaining |node_|. | 31 // Node is responsible for maintaining |node_|. |
36 friend class Node; | 32 friend class Node; |
37 | 33 |
38 void set_node(Node* node) { node_ = node; } | 34 void set_node(Node* node) { node_ = node; } |
39 | 35 |
40 const ViewId id_; | 36 const ViewId id_; |
41 Node* node_; | 37 Node* node_; |
42 SkBitmap bitmap_; | |
43 | 38 |
44 DISALLOW_COPY_AND_ASSIGN(View); | 39 DISALLOW_COPY_AND_ASSIGN(View); |
45 }; | 40 }; |
46 | 41 |
47 } // namespace view_manager | 42 } // namespace view_manager |
48 } // namespace services | 43 } // namespace services |
49 } // namespace mojo | 44 } // namespace mojo |
50 | 45 |
51 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_H_ | 46 #endif // MOJO_SERVICES_VIEW_MANAGER_VIEW_H_ |
OLD | NEW |