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

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

Issue 1378523002: Use scoped_refptr and RefCountedThreadSafe for TargetPolicy. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated patchset dependency Created 5 years, 1 month 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/policy_target_test.cc ('k') | sandbox/win/src/sandbox_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Sandbox is a sandbox library for windows processes. Use when you want a 5 // Sandbox is a sandbox library for windows processes. Use when you want a
6 // 'privileged' process and a 'locked down process' to interact with. 6 // 'privileged' process and a 'locked down process' to interact with.
7 // The privileged process is called the broker and it is started by external 7 // The privileged process is called the broker and it is started by external
8 // means (such as the user starting it). The 'sandboxed' process is called the 8 // means (such as the user starting it). The 'sandboxed' process is called the
9 // target and it is started by the broker. There can be many target processes 9 // target and it is started by the broker. There can be many target processes
10 // started by a single broker process. This library provides facilities 10 // started by a single broker process. This library provides facilities
11 // for both the broker and the target. 11 // for both the broker and the target.
12 // 12 //
13 // The design rationale and relevant documents can be found at http://go/sbox. 13 // The design rationale and relevant documents can be found at http://go/sbox.
14 // 14 //
15 // Note: this header does not include the SandboxFactory definitions because 15 // Note: this header does not include the SandboxFactory definitions because
16 // there are cases where the Sandbox library is linked against the main .exe 16 // there are cases where the Sandbox library is linked against the main .exe
17 // while its API needs to be used in a DLL. 17 // while its API needs to be used in a DLL.
18 18
19 #ifndef SANDBOX_WIN_SRC_SANDBOX_H_ 19 #ifndef SANDBOX_WIN_SRC_SANDBOX_H_
20 #define SANDBOX_WIN_SRC_SANDBOX_H_ 20 #define SANDBOX_WIN_SRC_SANDBOX_H_
21 21
22 #include <windows.h> 22 #include <windows.h>
23 23
24 #include "base/basictypes.h" 24 #include "base/basictypes.h"
25 #include "base/memory/ref_counted.h"
25 #include "sandbox/win/src/sandbox_policy.h" 26 #include "sandbox/win/src/sandbox_policy.h"
26 #include "sandbox/win/src/sandbox_types.h" 27 #include "sandbox/win/src/sandbox_types.h"
27 28
28 // sandbox: Google User-Land Application Sandbox 29 // sandbox: Google User-Land Application Sandbox
29 namespace sandbox { 30 namespace sandbox {
30 31
31 class BrokerServices; 32 class BrokerServices;
32 class ProcessState; 33 class ProcessState;
33 class TargetPolicy; 34 class TargetPolicy;
34 class TargetServices; 35 class TargetServices;
(...skipping 15 matching lines...) Expand all
50 public: 51 public:
51 // Initializes the broker. Must be called before any other on this class. 52 // Initializes the broker. Must be called before any other on this class.
52 // returns ALL_OK if successful. All other return values imply failure. 53 // returns ALL_OK if successful. All other return values imply failure.
53 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get 54 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get
54 // more information. 55 // more information.
55 virtual ResultCode Init() = 0; 56 virtual ResultCode Init() = 0;
56 57
57 // Returns the interface pointer to a new, empty policy object. Use this 58 // Returns the interface pointer to a new, empty policy object. Use this
58 // interface to specify the sandbox policy for new processes created by 59 // interface to specify the sandbox policy for new processes created by
59 // SpawnTarget() 60 // SpawnTarget()
60 virtual TargetPolicy* CreatePolicy() = 0; 61 virtual scoped_refptr<TargetPolicy> CreatePolicy() = 0;
61 62
62 // Creates a new target (child process) in a suspended state. 63 // Creates a new target (child process) in a suspended state.
63 // Parameters: 64 // Parameters:
64 // exe_path: This is the full path to the target binary. This parameter 65 // exe_path: This is the full path to the target binary. This parameter
65 // can be null and in this case the exe path must be the first argument 66 // can be null and in this case the exe path must be the first argument
66 // of the command_line. 67 // of the command_line.
67 // command_line: The arguments to be passed as command line to the new 68 // command_line: The arguments to be passed as command line to the new
68 // process. This can be null if the exe_path parameter is not null. 69 // process. This can be null if the exe_path parameter is not null.
69 // policy: This is the pointer to the policy object for the sandbox to 70 // policy: This is the pointer to the policy object for the sandbox to
70 // be created. 71 // be created.
71 // target: returns the resulting target process information such as process 72 // target: returns the resulting target process information such as process
72 // handle and PID just as if CreateProcess() had been called. The caller is 73 // handle and PID just as if CreateProcess() had been called. The caller is
73 // responsible for closing the handles returned in this structure. 74 // responsible for closing the handles returned in this structure.
74 // Returns: 75 // Returns:
75 // ALL_OK if successful. All other return values imply failure. 76 // ALL_OK if successful. All other return values imply failure.
76 virtual ResultCode SpawnTarget(const wchar_t* exe_path, 77 virtual ResultCode SpawnTarget(const wchar_t* exe_path,
77 const wchar_t* command_line, 78 const wchar_t* command_line,
78 TargetPolicy* policy, 79 scoped_refptr<TargetPolicy> policy,
79 PROCESS_INFORMATION* target) = 0; 80 PROCESS_INFORMATION* target) = 0;
80 81
81 // This call blocks (waits) for all the targets to terminate. 82 // This call blocks (waits) for all the targets to terminate.
82 // Returns: 83 // Returns:
83 // ALL_OK if successful. All other return values imply failure. 84 // ALL_OK if successful. All other return values imply failure.
84 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get 85 // If the return is ERROR_GENERIC, you can call ::GetLastError() to get
85 // more information. 86 // more information.
86 virtual ResultCode WaitForAllTargets() = 0; 87 virtual ResultCode WaitForAllTargets() = 0;
87 88
88 // Adds an unsandboxed process as a peer for policy decisions (e.g. 89 // Adds an unsandboxed process as a peer for policy decisions (e.g.
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 DWORD target_process_id, 157 DWORD target_process_id,
157 HANDLE* target_handle, 158 HANDLE* target_handle,
158 DWORD desired_access, 159 DWORD desired_access,
159 DWORD options) = 0; 160 DWORD options) = 0;
160 }; 161 };
161 162
162 } // namespace sandbox 163 } // namespace sandbox
163 164
164 165
165 #endif // SANDBOX_WIN_SRC_SANDBOX_H_ 166 #endif // SANDBOX_WIN_SRC_SANDBOX_H_
OLDNEW
« no previous file with comments | « sandbox/win/src/policy_target_test.cc ('k') | sandbox/win/src/sandbox_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698