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

Side by Side Diff: sandbox/win/src/sandbox.cc

Issue 1851213002: Remove sandbox on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nacl compile issues Created 4 years, 8 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
« no previous file with comments | « sandbox/win/src/sandbox.h ('k') | sandbox/win/src/sandbox.vcproj » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 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 <stdio.h>
6 #include <windows.h>
7 #include "sandbox/win/src/sandbox.h"
8 #include "sandbox/win/src/sandbox_factory.h"
9 #include "sandbox/win/src/broker_services.h"
10 #include "sandbox/win/src/target_services.h"
11
12 namespace sandbox {
13 // The section for IPC and policy.
14 SANDBOX_INTERCEPT HANDLE g_shared_section;
15 static bool s_is_broker = false;
16
17 // GetBrokerServices: the current implementation relies on a shared section
18 // that is created by the broker and opened by the target.
19 BrokerServices* SandboxFactory::GetBrokerServices() {
20 // Can't be the broker if the shared section is open.
21 if (NULL != g_shared_section) {
22 return NULL;
23 }
24 // If the shared section does not exist we are the broker, then create
25 // the broker object.
26 s_is_broker = true;
27 return BrokerServicesBase::GetInstance();
28 }
29
30 // GetTargetServices implementation must follow the same technique as the
31 // GetBrokerServices, but in this case the logic is the opposite.
32 TargetServices* SandboxFactory::GetTargetServices() {
33 // Can't be the target if the section handle is not valid.
34 if (NULL == g_shared_section) {
35 return NULL;
36 }
37 // We are the target
38 s_is_broker = false;
39 // Creates and returns the target services implementation.
40 return TargetServicesBase::GetInstance();
41 }
42
43 } // namespace sandbox
44
45 // Allows querying for whether the current process has been sandboxed.
46 extern "C" bool __declspec(dllexport) IsSandboxedProcess() {
47 return sandbox::g_shared_section != NULL;
48 }
OLDNEW
« no previous file with comments | « sandbox/win/src/sandbox.h ('k') | sandbox/win/src/sandbox.vcproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698