Add a CEF_ENABLE_SANDBOX define in cefclient and cefsimple to make disabling the sandbox easier for non-VS2010 builds of the binary distribution (issue #524).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1546 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
68916c9571
commit
b28ce63adb
|
@ -21,6 +21,17 @@
|
|||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
|
||||
// Set to 0 to disable sandbox support.
|
||||
#define CEF_ENABLE_SANDBOX 1
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// The cef_sandbox.lib static library is currently built with VS2010. It may not
|
||||
// link successfully with other VS versions.
|
||||
#pragma comment(lib, "cef_sandbox.lib")
|
||||
#endif
|
||||
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define MAX_URL_LENGTH 255
|
||||
#define BUTTON_WIDTH 72
|
||||
|
@ -67,15 +78,20 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
// Manages the life span of the sandbox information object.
|
||||
void* sandbox_info = NULL;
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// Manage the life span of the sandbox information object. This is necessary
|
||||
// for sandbox support on Windows. See cef_sandbox_win.h for complete details.
|
||||
CefScopedSandboxInfo scoped_sandbox;
|
||||
sandbox_info = scoped_sandbox.sandbox_info();
|
||||
#endif
|
||||
|
||||
CefMainArgs main_args(hInstance);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get(),
|
||||
scoped_sandbox.sandbox_info());
|
||||
int exit_code = CefExecuteProcess(main_args, app.get(), sandbox_info);
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
|
@ -88,11 +104,15 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
|
||||
CefSettings settings;
|
||||
|
||||
#if !CEF_ENABLE_SANDBOX
|
||||
settings.no_sandbox = true;
|
||||
#endif
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get(), scoped_sandbox.sandbox_info());
|
||||
CefInitialize(main_args, settings, app.get(), sandbox_info);
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
|
|
@ -7,6 +7,17 @@
|
|||
#include "cefsimple/simple_app.h"
|
||||
#include "include/cef_sandbox_win.h"
|
||||
|
||||
|
||||
// Set to 0 to disable sandbox support.
|
||||
#define CEF_ENABLE_SANDBOX 1
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// The cef_sandbox.lib static library is currently built with VS2010. It may not
|
||||
// link successfully with other VS versions.
|
||||
#pragma comment(lib, "cef_sandbox.lib")
|
||||
#endif
|
||||
|
||||
|
||||
// Entry point function for all processes.
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
|
@ -15,9 +26,14 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
void* sandbox_info = NULL;
|
||||
|
||||
#if CEF_ENABLE_SANDBOX
|
||||
// Manage the life span of the sandbox information object. This is necessary
|
||||
// for sandbox support on Windows. See cef_sandbox_win.h for complete details.
|
||||
CefScopedSandboxInfo scoped_sandbox;
|
||||
sandbox_info = scoped_sandbox.sandbox_info();
|
||||
#endif
|
||||
|
||||
// Provide CEF with command-line arguments.
|
||||
CefMainArgs main_args(hInstance);
|
||||
|
@ -29,8 +45,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
// CEF applications have multiple sub-processes (render, plugin, GPU, etc)
|
||||
// that share the same executable. This function checks the command-line and,
|
||||
// if this is a sub-process, executes the appropriate logic.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get(),
|
||||
scoped_sandbox.sandbox_info());
|
||||
int exit_code = CefExecuteProcess(main_args, app.get(), sandbox_info);
|
||||
if (exit_code >= 0) {
|
||||
// The sub-process has completed so return here.
|
||||
return exit_code;
|
||||
|
@ -39,8 +54,12 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
|
|||
// Specify CEF global settings here.
|
||||
CefSettings settings;
|
||||
|
||||
#if !CEF_ENABLE_SANDBOX
|
||||
settings.no_sandbox = true;
|
||||
#endif
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get(), scoped_sandbox.sandbox_info());
|
||||
CefInitialize(main_args, settings, app.get(), sandbox_info);
|
||||
|
||||
// Run the CEF message loop. This will block until CefQuitMessageLoop() is
|
||||
// called.
|
||||
|
|
|
@ -113,9 +113,12 @@
|
|||
'-lopengl32.lib',
|
||||
'-lglu32.lib',
|
||||
'-l$(ConfigurationName)/libcef.lib',
|
||||
'-l$(ConfigurationName)/cef_sandbox.lib',
|
||||
],
|
||||
},
|
||||
'library_dirs': [
|
||||
# Needed to find cef_sandbox.lib using #pragma comment(lib, ...).
|
||||
'$(ConfigurationName)',
|
||||
],
|
||||
'sources': [
|
||||
'<@(includes_win)',
|
||||
'<@(cefclient_sources_win)',
|
||||
|
@ -329,9 +332,12 @@
|
|||
'-lshlwapi.lib',
|
||||
'-lrpcrt4.lib',
|
||||
'-l$(ConfigurationName)/libcef.lib',
|
||||
'-l$(ConfigurationName)/cef_sandbox.lib',
|
||||
],
|
||||
},
|
||||
'library_dirs': [
|
||||
# Needed to find cef_sandbox.lib using #pragma comment(lib, ...).
|
||||
'$(ConfigurationName)',
|
||||
],
|
||||
'sources': [
|
||||
'<@(includes_win)',
|
||||
'<@(cefsimple_sources_win)',
|
||||
|
|
Loading…
Reference in New Issue