Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: sky/shell/platform_view.cc

Issue 932283002: Port touch-demo.sky to Dart and make it work in SkyShell (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sky/shell/platform_view.cc
diff --git a/sky/shell/platform_view.cc b/sky/shell/platform_view.cc
index e31498dcb39722b110723b8b354f9f0329b0960b..69a7b10a1c130ca00e18b43430d5b509e5cf0fd9 100644
--- a/sky/shell/platform_view.cc
+++ b/sky/shell/platform_view.cc
@@ -16,8 +16,12 @@
namespace sky {
namespace shell {
-static jlong Attach(JNIEnv* env, jclass clazz) {
- return reinterpret_cast<jlong>(Shell::Shared().view());
+static jlong Attach(JNIEnv* env, jclass clazz, jint viewportObserverHandle) {
+ PlatformView* view = Shell::Shared().view();
+ view->ConnectToViewportObserver(
+ mojo::MakeRequest<ViewportObserver>(mojo::ScopedMessagePipeHandle(
+ mojo::MessagePipeHandle(viewportObserverHandle))));
+ return reinterpret_cast<jlong>(view);
}
// static
@@ -34,6 +38,14 @@ PlatformView::~PlatformView() {
ReleaseWindow();
}
+void PlatformView::ConnectToViewportObserver(
+ mojo::InterfaceRequest<ViewportObserver> request) {
+ config_.ui_task_runner->PostTask(
+ FROM_HERE,
+ base::Bind(&UIDelegate::ConnectToViewportObserver, config_.ui_delegate,
+ base::Passed(&request)));
+}
+
void PlatformView::Detach(JNIEnv* env, jobject obj) {
DCHECK(!window_);
}
@@ -60,17 +72,6 @@ void PlatformView::SurfaceDestroyed(JNIEnv* env, jobject obj) {
ReleaseWindow();
}
-void PlatformView::SurfaceSetSize(JNIEnv* env,
- jobject obj,
- jint width,
- jint height,
- jfloat density) {
- config_.ui_task_runner->PostTask(
- FROM_HERE,
- base::Bind(&UIDelegate::OnViewportMetricsChanged, config_.ui_delegate,
- gfx::Size(width, height), density));
-}
-
void PlatformView::ReleaseWindow() {
ANativeWindow_release(window_);
window_ = nullptr;

Powered by Google App Engine
This is Rietveld 408576698