mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add sandbox support (issue #524).
- The sandbox is now enabled by default on all platforms. Use the CefSettings.no_sandbox option or the "no-sandbox" command-line flag to disable sandbox support. - Windows: See cef_sandbox_win.h for requirements to enable sandbox support. - Windows: If Visual Studio isn't installed in the standard location set the CEF_VCVARS environment variable before running make_distrib.py or automate.py (see msvs_env.bat). - Linux: For binary distributions a new chrome-sandbox executable with SUID permissions must be placed next to the CEF executable. See https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment for details on setting up the development environment when building CEF from source code. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1518 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -60,7 +60,8 @@ class CefForceShutdown {
|
||||
} // namespace
|
||||
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application) {
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
CommandLine command_line(CommandLine::NO_PROGRAM);
|
||||
#if defined(OS_WIN)
|
||||
command_line.ParseFromString(::GetCommandLineW());
|
||||
@@ -89,9 +90,14 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
// Execute the secondary process.
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
if (windows_sandbox_info == NULL) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
}
|
||||
|
||||
return content::ContentMain(args.instance, &sandbox_info, &main_delegate);
|
||||
return content::ContentMain(args.instance,
|
||||
static_cast<sandbox::SandboxInterfaceInfo*>(windows_sandbox_info),
|
||||
&main_delegate);
|
||||
#else
|
||||
return content::ContentMain(args.argc, const_cast<const char**>(args.argv),
|
||||
&main_delegate);
|
||||
@@ -100,7 +106,8 @@ int CefExecuteProcess(const CefMainArgs& args,
|
||||
|
||||
bool CefInitialize(const CefMainArgs& args,
|
||||
const CefSettings& settings,
|
||||
CefRefPtr<CefApp> application) {
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
// Return true if the global context already exists.
|
||||
if (g_context)
|
||||
return true;
|
||||
@@ -116,7 +123,8 @@ bool CefInitialize(const CefMainArgs& args,
|
||||
g_context = new CefContext();
|
||||
|
||||
// Initialize the global context.
|
||||
return g_context->Initialize(args, settings, application);
|
||||
return g_context->Initialize(args, settings, application,
|
||||
windows_sandbox_info);
|
||||
}
|
||||
|
||||
void CefShutdown() {
|
||||
@@ -222,7 +230,8 @@ CefContext* CefContext::Get() {
|
||||
|
||||
bool CefContext::Initialize(const CefMainArgs& args,
|
||||
const CefSettings& settings,
|
||||
CefRefPtr<CefApp> application) {
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
init_thread_id_ = base::PlatformThread::CurrentId();
|
||||
settings_ = settings;
|
||||
|
||||
@@ -257,10 +266,15 @@ bool CefContext::Initialize(const CefMainArgs& args,
|
||||
// Initialize the content runner.
|
||||
#if defined(OS_WIN)
|
||||
sandbox::SandboxInterfaceInfo sandbox_info = {0};
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
if (windows_sandbox_info == NULL) {
|
||||
content::InitializeSandboxInfo(&sandbox_info);
|
||||
windows_sandbox_info = &sandbox_info;
|
||||
settings_.no_sandbox = true;
|
||||
}
|
||||
|
||||
exit_code = main_runner_->Initialize(args.instance, &sandbox_info,
|
||||
main_delegate_.get());
|
||||
exit_code = main_runner_->Initialize(args.instance,
|
||||
static_cast<sandbox::SandboxInterfaceInfo*>(windows_sandbox_info),
|
||||
main_delegate_.get());
|
||||
#else
|
||||
exit_code = main_runner_->Initialize(args.argc,
|
||||
const_cast<const char**>(args.argv),
|
||||
|
Reference in New Issue
Block a user