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.
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"
12 #if defined(_WIN64) && !defined(NACL_WIN64)
13 // We allow building this code for Win64 as part of NaCl to enable development
14 #pragma message("Sandbox code was not fully tested on 64-bit Windows.\
20 // The section for IPC and policy.
21 SANDBOX_INTERCEPT HANDLE g_shared_section
= NULL
;
23 static bool s_is_broker
= false;
25 // GetBrokerServices: the current implementation relies on a shared section
26 // that is created by the broker and opened by the target.
27 BrokerServices
* SandboxFactory::GetBrokerServices() {
28 // Can't be the broker if the shared section is open.
29 if (NULL
!= g_shared_section
) {
32 // If the shared section does not exist we are the broker, then create
35 return BrokerServicesBase::GetInstance();
38 // GetTargetServices implementation must follow the same technique as the
39 // GetBrokerServices, but in this case the logic is the opposite.
40 TargetServices
* SandboxFactory::GetTargetServices() {
41 // Can't be the target if the section handle is not valid.
42 if (NULL
== g_shared_section
) {
47 // Creates and returns the target services implementation.
48 return TargetServicesBase::GetInstance();
51 } // namespace sandbox