Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Side by Side Diff: chrome/common/sandbox_init_wrapper.cc

Issue 17426: remove chrome dependencies from win sandboxing headers. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/sandbox_init_wrapper.h"
6
7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h"
9
10 #if defined(OS_MACOSX)
11 extern "C" {
12 #include <sandbox.h>
13 }
14 #endif
15
16 #if defined(OS_WIN)
17
18 void SandboxInitWrapper::SetServices(sandbox::SandboxInterfaceInfo* info) {
19 if (info) {
20 broker_services_ = info->broker_services;
21 target_services_ = info->target_services;
22 }
23 }
24
25 #endif
26
27 void SandboxInitWrapper::InitializeSandbox(const CommandLine& command_line,
28 const std::wstring& process_type) {
29 #if defined(OS_WIN)
30 if (!target_services_)
31 return;
32 #endif
33 if (!command_line.HasSwitch(switches::kNoSandbox)) {
34 if ((process_type == switches::kRendererProcess) ||
35 (process_type == switches::kPluginProcess &&
36 command_line.HasSwitch(switches::kSafePlugins))) {
37 #if defined(OS_WIN)
38 target_services_->Init();
39 #elif defined(OS_MACOSX)
40 // TODO(pinkerton): note, this leaks |error_buff|. What do we want to
41 // do with the error? Pass it back to main?
42 char* error_buff;
43 int error = sandbox_init(kSBXProfilePureComputation, SANDBOX_NAMED,
44 &error_buff);
45 if (error)
46 exit(-1);
47 #endif
48 }
49 }
50 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698