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; |