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