OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "sky/shell/android/platform_view_android.h" | 5 #include "sky/shell/android/platform_view_android.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "jni/PlatformViewAndroid_jni.h" | 13 #include "jni/PlatformViewAndroid_jni.h" |
14 #include "sky/shell/shell.h" | 14 #include "sky/shell/shell.h" |
15 #include "sky/shell/shell_view.h" | 15 #include "sky/shell/shell_view.h" |
16 | 16 |
17 namespace sky { | 17 namespace sky { |
18 namespace shell { | 18 namespace shell { |
19 | 19 |
20 static jlong Attach(JNIEnv* env, jclass clazz, jint viewportObserverHandle) { | 20 static jlong Attach(JNIEnv* env, jclass clazz, jint skyEngineHandle) { |
21 ShellView* shell_view = new ShellView(Shell::Shared()); | 21 ShellView* shell_view = new ShellView(Shell::Shared()); |
22 auto view = static_cast<PlatformViewAndroid*>(shell_view->view()); | 22 auto view = static_cast<PlatformViewAndroid*>(shell_view->view()); |
23 view->SetShellView(make_scoped_ptr(shell_view)); | 23 view->SetShellView(make_scoped_ptr(shell_view)); |
24 view->ConnectToViewportObserver( | 24 view->ConnectToEngine( |
25 mojo::MakeRequest<ViewportObserver>(mojo::ScopedMessagePipeHandle( | 25 mojo::MakeRequest<SkyEngine>(mojo::ScopedMessagePipeHandle( |
26 mojo::MessagePipeHandle(viewportObserverHandle)))); | 26 mojo::MessagePipeHandle(skyEngineHandle)))); |
27 return reinterpret_cast<jlong>(shell_view->view()); | 27 return reinterpret_cast<jlong>(shell_view->view()); |
28 } | 28 } |
29 | 29 |
30 // static | 30 // static |
31 bool PlatformViewAndroid::Register(JNIEnv* env) { | 31 bool PlatformViewAndroid::Register(JNIEnv* env) { |
32 return RegisterNativesImpl(env); | 32 return RegisterNativesImpl(env); |
33 } | 33 } |
34 | 34 |
35 PlatformView* PlatformView::Create(const Config& config) { | 35 PlatformView* PlatformView::Create(const Config& config) { |
36 return new PlatformViewAndroid(config); | 36 return new PlatformViewAndroid(config); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 shell_view_ = shell_view.Pass(); | 74 shell_view_ = shell_view.Pass(); |
75 } | 75 } |
76 | 76 |
77 void PlatformViewAndroid::ReleaseWindow() { | 77 void PlatformViewAndroid::ReleaseWindow() { |
78 ANativeWindow_release(window_); | 78 ANativeWindow_release(window_); |
79 window_ = nullptr; | 79 window_ = nullptr; |
80 } | 80 } |
81 | 81 |
82 } // namespace shell | 82 } // namespace shell |
83 } // namespace sky | 83 } // namespace sky |
OLD | NEW |