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 "base/command_line.h" |
9 #include "content/public/app/android_library_loader_hooks.h" | 9 #include "content/public/app/android_library_loader_hooks.h" |
10 #include "content/public/app/content_main.h" | 10 #include "content/public/app/content_main.h" |
11 #include "content/public/browser/android/compositor.h" | 11 #include "content/public/browser/android/compositor.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "ui/base/ui_base_switches.h" | |
13 | 14 |
14 // This is called by the VM when the shared library is first loaded. | 15 // This is called by the VM when the shared library is first loaded. |
15 // Most of the initialization is done in LibraryLoadedOnMainThread(), not here. | 16 // Most of the initialization is done in LibraryLoadedOnMainThread(), not here. |
16 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { | 17 JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { |
17 base::android::InitVM(vm); | 18 base::android::InitVM(vm); |
18 JNIEnv* env = base::android::AttachCurrentThread(); | 19 JNIEnv* env = base::android::AttachCurrentThread(); |
19 if (!content::RegisterLibraryLoaderEntryHook(env)) | 20 if (!content::RegisterLibraryLoaderEntryHook(env)) |
20 return -1; | 21 return -1; |
21 | 22 |
22 if (!android_webview::RegisterJni(env)) | 23 if (!android_webview::RegisterJni(env)) |
23 return -1; | 24 return -1; |
24 | 25 |
25 // Set the command line to enable synchronous API compatibility. | 26 // Set the command line to enable synchronous API compatibility. |
26 CommandLine::Init(0, NULL); | 27 CommandLine::Init(0, NULL); |
27 CommandLine::ForCurrentProcess()->AppendSwitch( | 28 CommandLine::ForCurrentProcess()->AppendSwitch( |
28 switches::kEnableWebViewSynchronousAPIs); | 29 switches::kEnableWebViewSynchronousAPIs); |
29 | 30 |
31 // TODO: The default locale needs to be set in order to prevent assertion | |
32 // failures in WebKit. However, this is really a single process mode issue | |
33 // and should be propery fixed. See bug 153758. | |
benm (inactive)
2012/10/03 13:10:48
sp properly
Leandro GraciĆ” Gil
2012/10/03 13:14:31
Done.
| |
34 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | |
35 switches::kLang, "en-US"); | |
36 | |
30 // TODO: The next two lines are temporarily required for the renderer | 37 // TODO: The next two lines are temporarily required for the renderer |
31 // initialization to not crash. | 38 // initialization to not crash. |
32 // See BUG 152904. | 39 // See BUG 152904. |
33 CommandLine::ForCurrentProcess()->AppendSwitch( | 40 CommandLine::ForCurrentProcess()->AppendSwitch( |
34 switches::kSingleProcess); | 41 switches::kSingleProcess); |
35 content::Compositor::Initialize(); | 42 content::Compositor::Initialize(); |
36 | 43 |
37 content::SetContentMainDelegate(new android_webview::AwMainDelegate()); | 44 content::SetContentMainDelegate(new android_webview::AwMainDelegate()); |
38 | 45 |
39 return JNI_VERSION_1_4; | 46 return JNI_VERSION_1_4; |
40 } | 47 } |
OLD | NEW |