| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "shell/android/mojo_main.h" | 5 #include "shell/android/mojo_main.h" |
| 6 | 6 |
| 7 #include "base/android/command_line_android.h" | 7 #include "base/android/command_line_android.h" |
| 8 #include "base/android/java_handler_thread.h" | 8 #include "base/android/java_handler_thread.h" |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "base/at_exit.h" | 11 #include "base/at_exit.h" |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 15 #include "base/lazy_instance.h" | 15 #include "base/lazy_instance.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "jni/MojoMain_jni.h" | 19 #include "jni/MojoMain_jni.h" |
| 20 #include "mojo/application_manager/application_loader.h" | 20 #include "mojo/application_manager/application_loader.h" |
| 21 #include "mojo/application_manager/background_shell_application_loader.h" | |
| 22 #include "shell/android/android_handler_loader.h" | 21 #include "shell/android/android_handler_loader.h" |
| 22 #include "shell/android/background_application_loader.h" |
| 23 #include "shell/android/native_viewport_application_loader.h" | 23 #include "shell/android/native_viewport_application_loader.h" |
| 24 #include "shell/android/ui_application_loader_android.h" | 24 #include "shell/android/ui_application_loader_android.h" |
| 25 #include "shell/context.h" | 25 #include "shell/context.h" |
| 26 #include "shell/init.h" | 26 #include "shell/init.h" |
| 27 #include "ui/gl/gl_surface_egl.h" | 27 #include "ui/gl/gl_surface_egl.h" |
| 28 | 28 |
| 29 using base::LazyInstance; | 29 using base::LazyInstance; |
| 30 | 30 |
| 31 namespace mojo { | 31 namespace mojo { |
| 32 namespace shell { | 32 namespace shell { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 context->application_manager()->SetLoaderForURL( | 45 context->application_manager()->SetLoaderForURL( |
| 46 make_scoped_ptr(new UIApplicationLoader( | 46 make_scoped_ptr(new UIApplicationLoader( |
| 47 make_scoped_ptr(new NativeViewportApplicationLoader()), | 47 make_scoped_ptr(new NativeViewportApplicationLoader()), |
| 48 g_java_message_loop.Get().get())), | 48 g_java_message_loop.Get().get())), |
| 49 GURL("mojo:native_viewport_service")); | 49 GURL("mojo:native_viewport_service")); |
| 50 | 50 |
| 51 // Android handler is bundled with the Mojo shell, because it uses the | 51 // Android handler is bundled with the Mojo shell, because it uses the |
| 52 // MojoShell application as the JNI bridge to bootstrap execution of other | 52 // MojoShell application as the JNI bridge to bootstrap execution of other |
| 53 // Android Mojo apps that need JNI. | 53 // Android Mojo apps that need JNI. |
| 54 context->application_manager()->SetLoaderForURL( | 54 context->application_manager()->SetLoaderForURL( |
| 55 make_scoped_ptr(new BackgroundShellApplicationLoader( | 55 make_scoped_ptr(new BackgroundApplicationLoader( |
| 56 make_scoped_ptr(new AndroidHandlerLoader()), "android_handler", | 56 make_scoped_ptr(new AndroidHandlerLoader()), "android_handler", |
| 57 base::MessageLoop::TYPE_DEFAULT)), | 57 base::MessageLoop::TYPE_DEFAULT)), |
| 58 GURL("mojo:android_handler")); | 58 GURL("mojo:android_handler")); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void RunShell(std::vector<GURL> app_urls) { | 61 void RunShell(std::vector<GURL> app_urls) { |
| 62 Context* context = g_context.Pointer()->get(); | 62 Context* context = g_context.Pointer()->get(); |
| 63 ConfigureAndroidServices(context); | 63 ConfigureAndroidServices(context); |
| 64 context->Init(); | 64 context->Init(); |
| 65 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 65 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 g_shell_thread.Get()->message_loop()->PostTask( | 119 g_shell_thread.Get()->message_loop()->PostTask( |
| 120 FROM_HERE, base::Bind(&RunShell, app_urls)); | 120 FROM_HERE, base::Bind(&RunShell, app_urls)); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool RegisterMojoMain(JNIEnv* env) { | 123 bool RegisterMojoMain(JNIEnv* env) { |
| 124 return RegisterNativesImpl(env); | 124 return RegisterNativesImpl(env); |
| 125 } | 125 } |
| 126 | 126 |
| 127 } // namespace shell | 127 } // namespace shell |
| 128 } // namespace mojo | 128 } // namespace mojo |
| OLD | NEW |