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/application_manager.h" | 21 #include "mojo/application_manager/application_manager.h" |
22 #include "mojo/application_manager/background_shell_application_loader.h" | |
23 #include "services/gles2/gpu_impl.h" | 22 #include "services/gles2/gpu_impl.h" |
24 #include "services/native_viewport/native_viewport_impl.h" | 23 #include "services/native_viewport/native_viewport_impl.h" |
25 #include "shell/android/android_handler_loader.h" | 24 #include "shell/android/android_handler_loader.h" |
| 25 #include "shell/android/background_application_loader.h" |
26 #include "shell/android/ui_application_loader_android.h" | 26 #include "shell/android/ui_application_loader_android.h" |
27 #include "shell/context.h" | 27 #include "shell/context.h" |
28 #include "shell/init.h" | 28 #include "shell/init.h" |
29 #include "ui/gl/gl_surface_egl.h" | 29 #include "ui/gl/gl_surface_egl.h" |
30 | 30 |
31 using base::LazyInstance; | 31 using base::LazyInstance; |
32 | 32 |
33 namespace mojo { | 33 namespace mojo { |
34 namespace shell { | 34 namespace shell { |
35 | 35 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 context->application_manager()->SetLoaderForURL( | 94 context->application_manager()->SetLoaderForURL( |
95 make_scoped_ptr(new UIApplicationLoader( | 95 make_scoped_ptr(new UIApplicationLoader( |
96 make_scoped_ptr(new NativeViewportApplicationLoader()), | 96 make_scoped_ptr(new NativeViewportApplicationLoader()), |
97 g_java_message_loop.Get().get())), | 97 g_java_message_loop.Get().get())), |
98 GURL("mojo:native_viewport_service")); | 98 GURL("mojo:native_viewport_service")); |
99 | 99 |
100 // Android handler is bundled with the Mojo shell, because it uses the | 100 // Android handler is bundled with the Mojo shell, because it uses the |
101 // MojoShell application as the JNI bridge to bootstrap execution of other | 101 // MojoShell application as the JNI bridge to bootstrap execution of other |
102 // Android Mojo apps that need JNI. | 102 // Android Mojo apps that need JNI. |
103 context->application_manager()->SetLoaderForURL( | 103 context->application_manager()->SetLoaderForURL( |
104 make_scoped_ptr(new BackgroundShellApplicationLoader( | 104 make_scoped_ptr(new BackgroundApplicationLoader( |
105 make_scoped_ptr(new AndroidHandlerLoader()), "android_handler", | 105 make_scoped_ptr(new AndroidHandlerLoader()), "android_handler", |
106 base::MessageLoop::TYPE_DEFAULT)), | 106 base::MessageLoop::TYPE_DEFAULT)), |
107 GURL("mojo:android_handler")); | 107 GURL("mojo:android_handler")); |
108 } | 108 } |
109 | 109 |
110 void RunShell(std::vector<GURL> app_urls) { | 110 void RunShell(std::vector<GURL> app_urls) { |
111 Context* context = g_context.Pointer()->get(); | 111 Context* context = g_context.Pointer()->get(); |
112 context->Init(); | 112 context->Init(); |
113 ConfigureAndroidServices(context); | 113 ConfigureAndroidServices(context); |
114 for (std::vector<GURL>::const_iterator it = app_urls.begin(); | 114 for (std::vector<GURL>::const_iterator it = app_urls.begin(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 g_shell_thread.Get()->message_loop()->PostTask( | 168 g_shell_thread.Get()->message_loop()->PostTask( |
169 FROM_HERE, base::Bind(&RunShell, app_urls)); | 169 FROM_HERE, base::Bind(&RunShell, app_urls)); |
170 } | 170 } |
171 | 171 |
172 bool RegisterMojoMain(JNIEnv* env) { | 172 bool RegisterMojoMain(JNIEnv* env) { |
173 return RegisterNativesImpl(env); | 173 return RegisterNativesImpl(env); |
174 } | 174 } |
175 | 175 |
176 } // namespace shell | 176 } // namespace shell |
177 } // namespace mojo | 177 } // namespace mojo |
OLD | NEW |