Share sky::PlatformImpl bettween sky_viewer and SkyShell
This should let SkyShell load images. R=eseidel@chromium.org BUG=https://github.com/domokit/mojo/issues/52 Review URL: https://codereview.chromium.org/959773005
This commit is contained in:
parent
f5c662cbbd
commit
24c33e48dc
@ -47,8 +47,6 @@ shared_library("sky_shell") {
|
||||
"ui/engine.h",
|
||||
"ui/input_event_converter.cc",
|
||||
"ui/input_event_converter.h",
|
||||
"ui/platform_impl.cc",
|
||||
"ui/platform_impl.h",
|
||||
"ui_delegate.cc",
|
||||
"ui_delegate.h",
|
||||
]
|
||||
@ -65,6 +63,7 @@ shared_library("sky_shell") {
|
||||
"//mojo/services/network/public/interfaces",
|
||||
"//skia",
|
||||
"//sky/engine",
|
||||
"//sky/services/platform",
|
||||
"//sky/services/viewport",
|
||||
"//ui/gfx/geometry",
|
||||
"//ui/gl",
|
||||
|
@ -5,14 +5,15 @@
|
||||
#include "sky/shell/ui/engine.h"
|
||||
|
||||
#include "base/bind.h"
|
||||
#include "mojo/public/cpp/application/connect.h"
|
||||
#include "sky/engine/public/platform/WebInputEvent.h"
|
||||
#include "sky/engine/public/web/Sky.h"
|
||||
#include "sky/engine/public/web/WebLocalFrame.h"
|
||||
#include "sky/engine/public/web/WebSettings.h"
|
||||
#include "sky/engine/public/web/WebView.h"
|
||||
#include "sky/services/platform/platform_impl.h"
|
||||
#include "sky/shell/ui/animator.h"
|
||||
#include "sky/shell/ui/input_event_converter.h"
|
||||
#include "sky/shell/ui/platform_impl.h"
|
||||
#include "third_party/skia/include/core/SkCanvas.h"
|
||||
#include "third_party/skia/include/core/SkPictureRecorder.h"
|
||||
|
||||
@ -46,9 +47,13 @@ base::WeakPtr<Engine> Engine::GetWeakPtr() {
|
||||
return weak_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
void Engine::Init(mojo::ScopedMessagePipeHandle service_provider) {
|
||||
platform_impl_.reset(new PlatformImpl(
|
||||
mojo::MakeProxy<mojo::ServiceProvider>(service_provider.Pass())));
|
||||
void Engine::Init(mojo::ScopedMessagePipeHandle service_provider_handle) {
|
||||
mojo::ServiceProviderPtr service_provider =
|
||||
mojo::MakeProxy<mojo::ServiceProvider>(service_provider_handle.Pass());
|
||||
mojo::NetworkServicePtr network_service;
|
||||
mojo::ConnectToService(service_provider.get(), &network_service);
|
||||
platform_impl_.reset(new PlatformImpl(network_service.Pass()));
|
||||
|
||||
blink::initialize(platform_impl_.get());
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,9 @@
|
||||
#include "ui/gfx/geometry/size.h"
|
||||
|
||||
namespace sky {
|
||||
class PlatformImpl;
|
||||
namespace shell {
|
||||
class Animator;
|
||||
class PlatformImpl;
|
||||
|
||||
class Engine : public UIDelegate,
|
||||
public ViewportObserver,
|
||||
|
@ -1,34 +0,0 @@
|
||||
// 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.
|
||||
|
||||
#include "sky/shell/ui/platform_impl.h"
|
||||
|
||||
#include "mojo/public/cpp/application/connect.h"
|
||||
|
||||
namespace sky {
|
||||
namespace shell {
|
||||
|
||||
PlatformImpl::PlatformImpl(mojo::ServiceProviderPtr service_provider)
|
||||
: main_thread_task_runner_(base::MessageLoop::current()->task_runner()),
|
||||
service_provider_(service_provider.Pass()) {
|
||||
mojo::ConnectToService(service_provider_.get(), &network_service_);
|
||||
}
|
||||
|
||||
PlatformImpl::~PlatformImpl() {
|
||||
}
|
||||
|
||||
blink::WebString PlatformImpl::defaultLocale() {
|
||||
return blink::WebString::fromUTF8("en-US");
|
||||
}
|
||||
|
||||
base::SingleThreadTaskRunner* PlatformImpl::mainThreadTaskRunner() {
|
||||
return main_thread_task_runner_.get();
|
||||
}
|
||||
|
||||
mojo::NetworkService* PlatformImpl::networkService() {
|
||||
return network_service_.get();
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
} // namespace sky
|
@ -1,37 +0,0 @@
|
||||
// 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_SHELL_UI_PLATFORM_IMPL_H_
|
||||
#define SKY_SHELL_UI_PLATFORM_IMPL_H_
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "mojo/public/interfaces/application/service_provider.mojom.h"
|
||||
#include "mojo/services/network/public/interfaces/network_service.mojom.h"
|
||||
#include "sky/engine/public/platform/Platform.h"
|
||||
|
||||
namespace sky {
|
||||
namespace shell {
|
||||
|
||||
class PlatformImpl : public blink::Platform {
|
||||
public:
|
||||
explicit PlatformImpl(mojo::ServiceProviderPtr service_provider);
|
||||
~PlatformImpl() override;
|
||||
|
||||
// blink::Platform:
|
||||
blink::WebString defaultLocale() override;
|
||||
base::SingleThreadTaskRunner* mainThreadTaskRunner() override;
|
||||
mojo::NetworkService* networkService() override;
|
||||
|
||||
private:
|
||||
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
|
||||
mojo::ServiceProviderPtr service_provider_;
|
||||
mojo::NetworkServicePtr network_service_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(PlatformImpl);
|
||||
};
|
||||
|
||||
} // namespace shell
|
||||
} // namespace sky
|
||||
|
||||
#endif // SKY_SHELL_UI_PLATFORM_IMPL_H_
|
Loading…
x
Reference in New Issue
Block a user