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 <stdlib.h> | |
6 | |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/debug/debugger.h" | 8 #include "base/debug/debugger.h" |
7 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
8 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
9 #include "base/threading/platform_thread.h" | 11 #include "base/threading/platform_thread.h" |
10 #include "build/build_config.h" | 12 #include "build/build_config.h" |
11 #include "content/common/child_process.h" | 13 #include "content/common/child_process.h" |
12 #include "content/ppapi_plugin/ppapi_thread.h" | 14 #include "content/ppapi_plugin/ppapi_thread.h" |
13 #include "content/public/common/content_switches.h" | 15 #include "content/public/common/content_switches.h" |
14 #include "content/public/common/main_function_params.h" | 16 #include "content/public/common/main_function_params.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
46 else | 48 else |
47 ChildProcess::WaitForDebugger("Ppapi"); | 49 ChildProcess::WaitForDebugger("Ppapi"); |
48 } | 50 } |
49 | 51 |
50 // Set the default locale to be the current UI language. WebKit uses ICU's | 52 // Set the default locale to be the current UI language. WebKit uses ICU's |
51 // default locale for some font settings (especially switching between | 53 // default locale for some font settings (especially switching between |
52 // Japanese and Chinese fonts for the same characters). | 54 // Japanese and Chinese fonts for the same characters). |
53 if (command_line.HasSwitch(switches::kLang)) { | 55 if (command_line.HasSwitch(switches::kLang)) { |
54 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); | 56 std::string locale = command_line.GetSwitchValueASCII(switches::kLang); |
55 base::i18n::SetICUDefaultLocale(locale); | 57 base::i18n::SetICUDefaultLocale(locale); |
58 std::replace(locale.begin(), locale.end(), '-', '_'); | |
59 setlocale(LC_ALL, locale.c_str()); | |
60 setenv("LANG", locale.c_str(), 0); | |
brettw
2012/10/12 05:50:53
Can you add a comment about why this is needed?
Scott Hess - ex-Googler
2012/10/12 06:15:05
Done. I'll poke around tomorrow morning and see i
| |
56 } | 61 } |
57 | 62 |
58 MessageLoop main_message_loop; | 63 MessageLoop main_message_loop; |
59 base::PlatformThread::SetName("CrPPAPIMain"); | 64 base::PlatformThread::SetName("CrPPAPIMain"); |
60 | 65 |
61 #if defined(OS_LINUX) | 66 #if defined(OS_LINUX) |
62 content::InitializeSandbox(); | 67 content::InitializeSandbox(); |
63 #endif | 68 #endif |
64 | 69 |
65 ChildProcess ppapi_process; | 70 ChildProcess ppapi_process; |
66 ppapi_process.set_main_thread( | 71 ppapi_process.set_main_thread( |
67 new PpapiThread(parameters.command_line, false)); // Not a broker. | 72 new PpapiThread(parameters.command_line, false)); // Not a broker. |
68 | 73 |
69 main_message_loop.Run(); | 74 main_message_loop.Run(); |
70 return 0; | 75 return 0; |
71 } | 76 } |
OLD | NEW |