| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "android_webview/lib/main/aw_main_delegate.h" | 5 #include "android_webview/lib/main/aw_main_delegate.h" |
| 6 #include "android_webview/native/android_webview_jni_registrar.h" | 6 #include "android_webview/native/android_webview_jni_registrar.h" |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/command_line.h" |
| 8 #include "content/public/app/android_library_loader_hooks.h" | 9 #include "content/public/app/android_library_loader_hooks.h" |
| 9 #include "content/public/app/content_main.h" | 10 #include "content/public/app/content_main.h" |
| 11 #include "content/public/common/content_switches.h" |
| 10 | 12 |
| 11 // This is called by the VM when the shared library is first loaded. | 13 // This is called by the VM when the shared library is first loaded. |
| 12 // Most of the initialization is done in LibraryLoadedOnMainThread(), not here. | 14 // Most of the initialization is done in LibraryLoadedOnMainThread(), not here. |
| 13 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 15 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
| 14 base::android::InitVM(vm); | 16 base::android::InitVM(vm); |
| 15 JNIEnv* env = base::android::AttachCurrentThread(); | 17 JNIEnv* env = base::android::AttachCurrentThread(); |
| 16 if (!content::RegisterLibraryLoaderEntryHook(env)) | 18 if (!content::RegisterLibraryLoaderEntryHook(env)) |
| 17 return -1; | 19 return -1; |
| 18 | 20 |
| 19 if (!android_webview::RegisterJni(env)) | 21 if (!android_webview::RegisterJni(env)) |
| 20 return -1; | 22 return -1; |
| 21 | 23 |
| 24 // Set the command line to enable synchronous API compatibility. |
| 25 CommandLine::Init(0, NULL); |
| 26 CommandLine::ForCurrentProcess()->AppendSwitch( |
| 27 switches::kEnableWebViewSynchronousAPIs); |
| 28 |
| 22 content::SetContentMainDelegate(new android_webview::AwMainDelegate()); | 29 content::SetContentMainDelegate(new android_webview::AwMainDelegate()); |
| 23 | 30 |
| 24 return JNI_VERSION_1_4; | 31 return JNI_VERSION_1_4; |
| 25 } | 32 } |
| OLD | NEW |