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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/debug/debugger.h" | 6 #include "base/debug/debugger.h" |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/threading/platform_thread.h" | 9 #include "base/threading/platform_thread.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 #if defined(OS_POSIX) && !defined(OS_ANDROID) | 26 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
27 #include <stdlib.h> | 27 #include <stdlib.h> |
28 #endif | 28 #endif |
29 | 29 |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 sandbox::TargetServices* g_target_services = NULL; | 31 sandbox::TargetServices* g_target_services = NULL; |
32 #else | 32 #else |
33 void* g_target_services = 0; | 33 void* g_target_services = 0; |
34 #endif | 34 #endif |
35 | 35 |
| 36 namespace content { |
| 37 |
36 // Main function for starting the PPAPI plugin process. | 38 // Main function for starting the PPAPI plugin process. |
37 int PpapiPluginMain(const content::MainFunctionParams& parameters) { | 39 int PpapiPluginMain(const MainFunctionParams& parameters) { |
38 const CommandLine& command_line = parameters.command_line; | 40 const CommandLine& command_line = parameters.command_line; |
39 | 41 |
40 #if defined(OS_WIN) | 42 #if defined(OS_WIN) |
41 g_target_services = parameters.sandbox_info->target_services; | 43 g_target_services = parameters.sandbox_info->target_services; |
42 #endif | 44 #endif |
43 | 45 |
44 // If |g_target_services| is not null this process is sandboxed. One side | 46 // If |g_target_services| is not null this process is sandboxed. One side |
45 // effect is that we can't pop dialogs like ChildProcess::WaitForDebugger() | 47 // effect is that we can't pop dialogs like ChildProcess::WaitForDebugger() |
46 // does. | 48 // does. |
47 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { | 49 if (command_line.HasSwitch(switches::kPpapiStartupDialog)) { |
(...skipping 22 matching lines...) Expand all Loading... |
70 std::replace(locale.begin(), locale.end(), '-', '_'); | 72 std::replace(locale.begin(), locale.end(), '-', '_'); |
71 setlocale(LC_ALL, locale.c_str()); | 73 setlocale(LC_ALL, locale.c_str()); |
72 setenv("LANG", locale.c_str(), 0); | 74 setenv("LANG", locale.c_str(), 0); |
73 #endif | 75 #endif |
74 } | 76 } |
75 | 77 |
76 MessageLoop main_message_loop; | 78 MessageLoop main_message_loop; |
77 base::PlatformThread::SetName("CrPPAPIMain"); | 79 base::PlatformThread::SetName("CrPPAPIMain"); |
78 | 80 |
79 #if defined(OS_LINUX) | 81 #if defined(OS_LINUX) |
80 content::InitializeSandbox(); | 82 InitializeSandbox(); |
81 #endif | 83 #endif |
82 | 84 |
83 ChildProcess ppapi_process; | 85 ChildProcess ppapi_process; |
84 ppapi_process.set_main_thread( | 86 ppapi_process.set_main_thread( |
85 new PpapiThread(parameters.command_line, false)); // Not a broker. | 87 new PpapiThread(parameters.command_line, false)); // Not a broker. |
86 | 88 |
87 main_message_loop.Run(); | 89 main_message_loop.Run(); |
88 return 0; | 90 return 0; |
89 } | 91 } |
| 92 |
| 93 } // namespace content |
OLD | NEW |