Add a stub __cxa_demangle to disable LLVM's demangler.
[chromium-blink-merge.git] / sandbox / win / src / target_services.h
blob867a44a478e6b581edcaaaab9dd6f48951da129c
1 // Copyright (c) 2012 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.
5 #ifndef SANDBOX_SRC_TARGET_SERVICES_H__
6 #define SANDBOX_SRC_TARGET_SERVICES_H__
8 #include "base/basictypes.h"
9 #include "sandbox/win/src/sandbox.h"
10 #include "sandbox/win/src/win_utils.h"
12 namespace sandbox {
14 class ProcessState {
15 public:
16 ProcessState();
17 // Returns true if kernel32.dll has been loaded.
18 bool IsKernel32Loaded() const;
19 // Returns true if main has been called.
20 bool InitCalled() const;
21 // Returns true if LowerToken has been called.
22 bool RevertedToSelf() const;
23 // Set the current state.
24 void SetKernel32Loaded();
25 void SetInitCalled();
26 void SetRevertedToSelf();
28 private:
29 int process_state_;
30 DISALLOW_COPY_AND_ASSIGN(ProcessState);
33 // This class is an implementation of the TargetServices.
34 // Look in the documentation of sandbox::TargetServices for more info.
35 // Do NOT add a destructor to this class without changing the implementation of
36 // the factory method.
37 class TargetServicesBase : public TargetServices {
38 public:
39 TargetServicesBase();
41 // Public interface of TargetServices.
42 ResultCode Init() override;
43 void LowerToken() override;
44 ProcessState* GetState() override;
45 ResultCode DuplicateHandle(HANDLE source_handle,
46 DWORD target_process_id,
47 HANDLE* target_handle,
48 DWORD desired_access,
49 DWORD options) override;
51 // Factory method.
52 static TargetServicesBase* GetInstance();
54 // Sends a simple IPC Message that has a well-known answer. Returns true
55 // if the IPC was successful and false otherwise. There are 2 versions of
56 // this test: 1 and 2. The first one send a simple message while the
57 // second one send a message with an in/out param.
58 bool TestIPCPing(int version);
60 private:
61 ProcessState process_state_;
62 DISALLOW_COPY_AND_ASSIGN(TargetServicesBase);
65 } // namespace sandbox
67 #endif // SANDBOX_SRC_TARGET_SERVICES_H__