| 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/main.h" | 5 #include "shell/android/main.h" |
| 6 | 6 |
| 7 #include "base/android/fifo_utils.h" | 7 #include "base/android/fifo_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.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/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
| 20 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
| 21 #include "base/threading/simple_thread.h" | 21 #include "base/threading/simple_thread.h" |
| 22 #include "jni/MojoMain_jni.h" | 22 #include "jni/ShellMain_jni.h" |
| 23 #include "mojo/common/message_pump_mojo.h" | 23 #include "mojo/common/message_pump_mojo.h" |
| 24 #include "shell/android/android_handler_loader.h" | 24 #include "shell/android/android_handler_loader.h" |
| 25 #include "shell/android/background_application_loader.h" | 25 #include "shell/android/background_application_loader.h" |
| 26 #include "shell/android/native_viewport_application_loader.h" | 26 #include "shell/android/native_viewport_application_loader.h" |
| 27 #include "shell/android/ui_application_loader_android.h" | 27 #include "shell/android/ui_application_loader_android.h" |
| 28 #include "shell/application_manager/application_loader.h" | 28 #include "shell/application_manager/application_loader.h" |
| 29 #include "shell/command_line_util.h" | 29 #include "shell/command_line_util.h" |
| 30 #include "shell/context.h" | 30 #include "shell/context.h" |
| 31 #include "shell/init.h" | 31 #include "shell/init.h" |
| 32 #include "ui/gl/gl_surface_egl.h" | 32 #include "ui/gl/gl_surface_egl.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 GURL("mojo:android_handler")); | 89 GURL("mojo:android_handler")); |
| 90 | 90 |
| 91 // By default, the keyboard is handled by the native_viewport_service. | 91 // By default, the keyboard is handled by the native_viewport_service. |
| 92 context->url_resolver()->AddURLMapping(GURL("mojo:keyboard"), | 92 context->url_resolver()->AddURLMapping(GURL("mojo:keyboard"), |
| 93 GURL("mojo:native_viewport_service")); | 93 GURL("mojo:native_viewport_service")); |
| 94 } | 94 } |
| 95 | 95 |
| 96 void QuitShellThread() { | 96 void QuitShellThread() { |
| 97 g_shell_thread.Get()->Join(); | 97 g_shell_thread.Get()->Join(); |
| 98 g_shell_thread.Pointer()->reset(); | 98 g_shell_thread.Pointer()->reset(); |
| 99 Java_MojoMain_finishActivity(base::android::AttachCurrentThread(), | 99 Java_ShellMain_finishActivity(base::android::AttachCurrentThread(), |
| 100 g_main_activiy.Get().obj()); | 100 g_main_activiy.Get().obj()); |
| 101 exit(0); | 101 exit(0); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void MojoShellRunner::Run() { | 104 void MojoShellRunner::Run() { |
| 105 base::MessageLoop loop(common::MessagePumpMojo::Create()); | 105 base::MessageLoop loop(common::MessagePumpMojo::Create()); |
| 106 Context* context = g_context.Pointer()->get(); | 106 Context* context = g_context.Pointer()->get(); |
| 107 ConfigureAndroidServices(context); | 107 ConfigureAndroidServices(context); |
| 108 context->Init(); | 108 context->Init(); |
| 109 | 109 |
| 110 for (auto& args : parameters_) | 110 for (auto& args : parameters_) |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 g_shell_runner.Get().get(), "ShellThread")); | 201 g_shell_runner.Get().get(), "ShellThread")); |
| 202 g_shell_thread.Get()->Start(); | 202 g_shell_thread.Get()->Start(); |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| 205 | 205 |
| 206 static void AddApplicationURL(JNIEnv* env, jclass clazz, jstring jurl) { | 206 static void AddApplicationURL(JNIEnv* env, jclass clazz, jstring jurl) { |
| 207 base::CommandLine::ForCurrentProcess()->AppendArg( | 207 base::CommandLine::ForCurrentProcess()->AppendArg( |
| 208 base::android::ConvertJavaStringToUTF8(env, jurl)); | 208 base::android::ConvertJavaStringToUTF8(env, jurl)); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool RegisterMojoMain(JNIEnv* env) { | 211 bool RegisterShellMain(JNIEnv* env) { |
| 212 return RegisterNativesImpl(env); | 212 return RegisterNativesImpl(env); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } // namespace shell | 215 } // namespace shell |
| 216 } // namespace mojo | 216 } // namespace mojo |
| OLD | NEW |