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

Unified Diff: shell/android/main.cc

Issue 1280613003: Allow native_viewport to create new native windows on demand on Android. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Refactor Created 5 years, 4 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: shell/android/main.cc
diff --git a/shell/android/main.cc b/shell/android/main.cc
index 6502015c0b28692fdc5dbc9b8be0dbaf10592d93..cdd525b35d62ed7d07b29c334be573e5e9b2054c 100644
--- a/shell/android/main.cc
+++ b/shell/android/main.cc
@@ -92,6 +92,7 @@ struct InternalShellData {
// Proxy to a Window Manager, initialized on the shell thread.
mojo::WindowManagerPtr window_manager;
+ mojo::NativeViewportShellServicePtr native_viewport;
// TaskRunner used to execute tasks on the shell thread.
scoped_refptr<base::SingleThreadTaskRunner> shell_task_runner;
@@ -196,6 +197,16 @@ void ConnectToApplicationImpl(
url, GURL(), services.Pass(), exposed_services.Pass(), base::Closure());
}
+void SendSurfaceAvailable() {
+ if (!g_internal_data.Get().native_viewport.get()) {
+ Context* context = g_internal_data.Get().context.get();
+ context->application_manager()->ConnectToService(
+ GURL("mojo:native_viewport_service"),
+ &g_internal_data.Get().native_viewport);
+ }
+ g_internal_data.Get().native_viewport->NewNativeSurfaceAvailable();
qsr 2015/08/07 11:18:01 This seems outdated.
etiennej 2015/08/07 12:22:11 Done.
+}
+
void EmbedApplicationByURL(std::string url) {
DCHECK(g_internal_data.Get().shell_task_runner->RunsTasksOnCurrentThread());
if (!g_internal_data.Get().window_manager.get()) {
@@ -335,6 +346,11 @@ static void ConnectToApplication(JNIEnv* env,
mojo::MessagePipeHandle(exposed_services_handle)))));
}
+static void SurfaceAvailable(JNIEnv* env, jclass clazz) {
+ g_internal_data.Get().shell_task_runner->PostTask(
+ FROM_HERE, base::Bind(&SendSurfaceAvailable));
+}
+
bool RegisterShellService(JNIEnv* env) {
return RegisterNativesImpl(env);
}

Powered by Google App Engine
This is Rietveld 408576698