sky_view.h 1.3 KB
Newer Older
1 2 3 4 5 6 7 8
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_
#define SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_

#include <memory>
A
Adam Barth 已提交
9
#include "base/memory/weak_ptr.h"
10 11 12
#include "skia/ext/refptr.h"
#include "sky/engine/public/platform/WebCommon.h"
#include "sky/engine/public/platform/WebURL.h"
A
Adam Barth 已提交
13
#include "sky/engine/public/platform/sky_display_metrics.h"
14 15 16
#include "third_party/skia/include/core/SkPicture.h"

namespace blink {
17
class DartController;
A
Adam Barth 已提交
18
class SkyViewClient;
19 20 21 22
class WebInputEvent;

class SkyView {
 public:
A
Adam Barth 已提交
23
  static std::unique_ptr<SkyView> Create(SkyViewClient* client);
24 25 26 27 28 29 30 31
  ~SkyView();

  void SetDisplayMetrics(const SkyDisplayMetrics& metrics);
  void Load(const WebURL& url);
  skia::RefPtr<SkPicture> Paint();
  bool HandleInputEvent(const WebInputEvent& event);

 private:
A
Adam Barth 已提交
32
  explicit SkyView(SkyViewClient* client);
33

A
Adam Barth 已提交
34 35 36 37 38
  void SchedulePaint();

  class Data;

  SkyViewClient* client_;
A
Adam Barth 已提交
39
  SkyDisplayMetrics display_metrics_;
40
  std::unique_ptr<DartController> dart_controller_;
A
Adam Barth 已提交
41 42 43
  std::unique_ptr<Data> data_;

  base::WeakPtrFactory<SkyView> weak_factory_;
44 45

  DISALLOW_COPY_AND_ASSIGN(SkyView);
46 47 48 49 50
};

} // namespace blink

#endif  // SKY_ENGINE_PUBLIC_SKY_SKY_VIEW_H_