summaryrefslogtreecommitdiffstats
path: root/chrome/nacl
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/nacl')
-rw-r--r--chrome/nacl/DEPS2
-rw-r--r--chrome/nacl/nacl_exe_win_64.cc36
-rw-r--r--chrome/nacl/nacl_main.cc2
-rw-r--r--chrome/nacl/nacl_main_platform_delegate_mac.mm12
-rw-r--r--chrome/nacl/nacl_main_platform_delegate_win.cc6
5 files changed, 15 insertions, 43 deletions
diff --git a/chrome/nacl/DEPS b/chrome/nacl/DEPS
index 93d77e9..9700f06 100644
--- a/chrome/nacl/DEPS
+++ b/chrome/nacl/DEPS
@@ -1,6 +1,6 @@
include_rules = [
"+chrome/app/breakpad_win.h",
- "+content/app/startup_helper_win.h",
+ "+content/public/app/startup_helper_win.h",
"+sandbox/src",
"+native_client/src",
]
diff --git a/chrome/nacl/nacl_exe_win_64.cc b/chrome/nacl/nacl_exe_win_64.cc
index 834fc37..c347c7b 100644
--- a/chrome/nacl/nacl_exe_win_64.cc
+++ b/chrome/nacl/nacl_exe_win_64.cc
@@ -16,12 +16,10 @@
#include "chrome/nacl/nacl_broker_listener.h"
#include "chrome/nacl/nacl_listener.h"
#include "chrome/nacl/nacl_main_platform_delegate.h"
-#include "content/app/startup_helper_win.h"
#include "content/common/hi_res_timer_manager.h"
#include "content/common/main_function_params.h"
-#include "content/common/sandbox_init_wrapper.h"
-#include "content/common/sandbox_policy.h"
-#include "sandbox/src/sandbox.h"
+#include "content/public/app/startup_helper_win.h"
+#include "content/public/common/sandbox_init.h"
#include "sandbox/src/sandbox_types.h"
extern int NaClMain(const MainFunctionParams&);
@@ -29,7 +27,7 @@ extern int NaClMain(const MainFunctionParams&);
// main() routine for the NaCl broker process.
// This is necessary for supporting NaCl in Chrome on Win64.
int NaClBrokerMain(const MainFunctionParams& parameters) {
- const CommandLine& parsed_command_line = parameters.command_line_;
+ const CommandLine& parsed_command_line = parameters.command_line;
MessageLoopForIO main_message_loop;
base::PlatformThread::SetName("CrNaClBrokerMain");
@@ -37,26 +35,6 @@ int NaClBrokerMain(const MainFunctionParams& parameters) {
base::SystemMonitor system_monitor;
HighResolutionTimerManager hi_res_timer_manager;
- // NOTE: this code is duplicated from browser_main.cc
- // IMPORTANT: This piece of code needs to run as early as possible in the
- // process because it will initialize the sandbox broker, which requires the
- // process to swap its window station. During this time all the UI will be
- // broken. This has to run before threads and windows are created.
- sandbox::BrokerServices* broker_services =
- parameters.sandbox_info_.BrokerServices();
- if (broker_services) {
- sandbox::InitBrokerServices(broker_services);
- if (!parsed_command_line.HasSwitch(switches::kNoSandbox)) {
- bool use_winsta = !parsed_command_line.HasSwitch(
- switches::kDisableAltWinstation);
- // Precreate the desktop and window station used by the renderers.
- sandbox::TargetPolicy* policy = broker_services->CreatePolicy();
- sandbox::ResultCode result = policy->CreateAlternateDesktop(use_winsta);
- CHECK(sandbox::SBOX_ERROR_FAILED_TO_SWITCH_BACK_WINSTATION != result);
- policy->Release();
- }
- }
-
NaClBrokerListener listener;
listener.Listen();
@@ -85,14 +63,12 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t*, int) {
content::SetupCRT(command_line);
// Initialize the sandbox for this process.
- SandboxInitWrapper sandbox_wrapper;
- sandbox_wrapper.SetServices(&sandbox_info);
- bool sandbox_initialized_ok =
- sandbox_wrapper.InitializeSandbox(command_line, process_type);
+ bool sandbox_initialized_ok = content::InitializeSandbox(&sandbox_info);
// Die if the sandbox can't be enabled.
CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
<< process_type;
- MainFunctionParams main_params(command_line, sandbox_wrapper, NULL);
+ MainFunctionParams main_params(command_line);
+ main_params.sandbox_info = &sandbox_info;
if (process_type == switches::kNaClLoaderProcess)
return NaClMain(main_params);
diff --git a/chrome/nacl/nacl_main.cc b/chrome/nacl/nacl_main.cc
index 4b3caae..87e37eb 100644
--- a/chrome/nacl/nacl_main.cc
+++ b/chrome/nacl/nacl_main.cc
@@ -30,7 +30,7 @@ static void HandleNaClTestParameters(const CommandLine& command_line) {
// main() routine for the NaCl loader process.
int NaClMain(const MainFunctionParams& parameters) {
- const CommandLine& parsed_command_line = parameters.command_line_;
+ const CommandLine& parsed_command_line = parameters.command_line;
// This function allows pausing execution using the --nacl-startup-dialog
// flag allowing us to attach a debugger.
diff --git a/chrome/nacl/nacl_main_platform_delegate_mac.mm b/chrome/nacl/nacl_main_platform_delegate_mac.mm
index 006ee25..c5eb65a 100644
--- a/chrome/nacl/nacl_main_platform_delegate_mac.mm
+++ b/chrome/nacl/nacl_main_platform_delegate_mac.mm
@@ -11,6 +11,7 @@
#include "base/native_library.h"
#include "chrome/common/chrome_switches.h"
#include "content/common/sandbox_mac.h"
+#include "content/public/common/sandbox_init.h"
NaClMainPlatformDelegate::NaClMainPlatformDelegate(
const MainFunctionParams& parameters)
@@ -32,7 +33,7 @@ void NaClMainPlatformDelegate::PlatformUninitialize() {
}
void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
- const CommandLine& command_line = parameters_.command_line_;
+ const CommandLine& command_line = parameters_.command_line;
DVLOG(1) << "Started NaClLdr with ";
const std::vector<std::string>& argstrings = command_line.argv();
@@ -54,13 +55,8 @@ void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
}
void NaClMainPlatformDelegate::EnableSandbox() {
- CommandLine* parsed_command_line = CommandLine::ForCurrentProcess();
- SandboxInitWrapper sandbox_wrapper;
- bool sandbox_initialized_ok =
- sandbox_wrapper.InitializeSandbox(*parsed_command_line,
- switches::kNaClLoaderProcess);
- CHECK(sandbox_initialized_ok) << "Error initializing sandbox for "
- << switches::kNaClLoaderProcess;
+ CHECK(content::InitializeSandbox()) << "Error initializing sandbox for "
+ << switches::kNaClLoaderProcess;
}
bool NaClMainPlatformDelegate::RunSandboxTests() {
diff --git a/chrome/nacl/nacl_main_platform_delegate_win.cc b/chrome/nacl/nacl_main_platform_delegate_win.cc
index 97ba3af..1ce923e 100644
--- a/chrome/nacl/nacl_main_platform_delegate_win.cc
+++ b/chrome/nacl/nacl_main_platform_delegate_win.cc
@@ -28,12 +28,12 @@ void NaClMainPlatformDelegate::PlatformUninitialize() {
}
void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
- const CommandLine& command_line = parameters_.command_line_;
+ const CommandLine& command_line = parameters_.command_line;
DVLOG(1) << "Started NaClLdr with " << command_line.GetCommandLineString();
sandbox::TargetServices* target_services =
- parameters_.sandbox_info_.TargetServices();
+ parameters_.sandbox_info->target_services;
if (target_services && !no_sandbox) {
FilePath test_dll_name =
@@ -59,7 +59,7 @@ void NaClMainPlatformDelegate::InitSandboxTests(bool no_sandbox) {
void NaClMainPlatformDelegate::EnableSandbox() {
sandbox::TargetServices* target_services =
- parameters_.sandbox_info_.TargetServices();
+ parameters_.sandbox_info->target_services;
CHECK(target_services) << "NaCl-Win EnableSandbox: No Target Services!";
// Cause advapi32 to load before the sandbox is turned on.