OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef SANDBOX_WIN_SRC_APP_CONTAINER_H_ | |
6 #define SANDBOX_WIN_SRC_APP_CONTAINER_H_ | |
7 | |
8 #include <windows.h> | |
9 | |
10 #include <vector> | |
11 | |
12 #include "base/macros.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string16.h" | |
15 #include "sandbox/win/src/sandbox_types.h" | |
16 | |
17 namespace base { | |
18 namespace win { | |
19 class StartupInformation; | |
20 } | |
21 } | |
22 | |
23 namespace sandbox { | |
24 | |
25 // Maintains an attribute list to be used during creation of a new sandboxed | |
26 // process. | |
27 class AppContainerAttributes { | |
28 public: | |
29 AppContainerAttributes(); | |
30 ~AppContainerAttributes(); | |
31 | |
32 // Sets the AppContainer and capabilities to be used with the new process. | |
33 ResultCode SetAppContainer(const base::string16& app_container_sid, | |
34 const std::vector<base::string16>& capabilities); | |
35 | |
36 // Updates the proc_thred attribute list of the provided startup_information | |
37 // with the app container related data. | |
38 // WARNING: startup_information just points back to our internal memory, so | |
39 // the lifetime of this object has to be greater than the lifetime of the | |
40 // provided startup_information. | |
41 ResultCode ShareForStartup( | |
42 base::win::StartupInformation* startup_information) const; | |
43 | |
44 bool HasAppContainer() const; | |
45 | |
46 private: | |
47 SECURITY_CAPABILITIES capabilities_; | |
48 std::vector<SID_AND_ATTRIBUTES> attributes_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(AppContainerAttributes); | |
51 }; | |
52 | |
53 // Creates a new AppContainer on the system. |sid| is the identifier of the new | |
54 // AppContainer, and |name| will be used as both the display name and moniker. | |
55 // This function fails if the OS doesn't support AppContainers, or if there is | |
56 // an AppContainer registered with the same id. | |
57 ResultCode CreateAppContainer(const base::string16& sid, | |
58 const base::string16& name); | |
59 | |
60 // Deletes an AppContainer previously created with a successful call to | |
61 // CreateAppContainer. | |
62 ResultCode DeleteAppContainer(const base::string16& sid); | |
63 | |
64 // Retrieves the name associated with the provided AppContainer sid. Returns an | |
65 // empty string if the AppContainer is not registered with the system. | |
66 base::string16 LookupAppContainer(const base::string16& sid); | |
67 | |
68 } // namespace sandbox | |
69 | |
70 #endif // SANDBOX_WIN_SRC_APP_CONTAINER_H_ | |
OLD | NEW |