| Index: sky/engine/public/sky/sky_view.cc
|
| diff --git a/sky/engine/public/sky/sky_view.cc b/sky/engine/public/sky/sky_view.cc
|
| index aa9776647d3b4f6dd59d3fa8ef2b4c820b413799..e9a6bdbd0d49ed0611b39a0f35c3200e9242a219 100644
|
| --- a/sky/engine/public/sky/sky_view.cc
|
| +++ b/sky/engine/public/sky/sky_view.cc
|
| @@ -5,17 +5,27 @@
|
| #include "config.h"
|
| #include "sky/engine/public/sky/sky_view.h"
|
|
|
| +#include "base/bind.h"
|
| #include "sky/engine/core/script/dart_controller.h"
|
| #include "sky/engine/core/script/dom_dart_state.h"
|
| +#include "sky/engine/core/view/View.h"
|
| #include "sky/engine/platform/weborigin/KURL.h"
|
| +#include "sky/engine/public/sky/sky_view_client.h"
|
|
|
| namespace blink {
|
|
|
| -std::unique_ptr<SkyView> SkyView::Create() {
|
| - return std::unique_ptr<SkyView>(new SkyView);
|
| +struct SkyView::Data {
|
| + RefPtr<View> view_;
|
| +};
|
| +
|
| +std::unique_ptr<SkyView> SkyView::Create(SkyViewClient* client) {
|
| + return std::unique_ptr<SkyView>(new SkyView(client));
|
| }
|
|
|
| -SkyView::SkyView() {
|
| +SkyView::SkyView(SkyViewClient* client)
|
| + : client_(client),
|
| + data_(new Data),
|
| + weak_factory_(this) {
|
| }
|
|
|
| SkyView::~SkyView() {
|
| @@ -29,12 +39,18 @@ void SkyView::SetDisplayMetrics(const SkyDisplayMetrics& metrics) {
|
| }
|
|
|
| void SkyView::Load(const WebURL& url) {
|
| + data_->view_ = View::create(base::Bind(
|
| + &SkyView::SchedulePaint, weak_factory_.GetWeakPtr()));
|
| +
|
| dart_controller_.reset(new DartController);
|
| dart_controller_->CreateIsolateFor(adoptPtr(new DOMDartState(nullptr)), url);
|
| + dart_controller_->InstallView(data_->view_.get());
|
| dart_controller_->LoadMainLibrary(url);
|
| }
|
|
|
| skia::RefPtr<SkPicture> SkyView::Paint() {
|
| + if (Picture* picture = data_->view_->picture())
|
| + return skia::SharePtr(picture->toSkia());
|
| return skia::RefPtr<SkPicture>();
|
| }
|
|
|
| @@ -42,4 +58,8 @@ bool SkyView::HandleInputEvent(const WebInputEvent& event) {
|
| return false;
|
| }
|
|
|
| +void SkyView::SchedulePaint() {
|
| + client_->SchedulePaint();
|
| +}
|
| +
|
| } // namespace blink
|
|
|