| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ | 5 #ifndef SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ |
| 6 #define SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ | 6 #define SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "sandbox/win/src/sandbox_policy.h" | 22 #include "sandbox/win/src/sandbox_policy.h" |
| 23 #include "sandbox/win/src/win_utils.h" | 23 #include "sandbox/win/src/win_utils.h" |
| 24 | 24 |
| 25 namespace sandbox { | 25 namespace sandbox { |
| 26 | 26 |
| 27 class AppContainerAttributes; | 27 class AppContainerAttributes; |
| 28 class LowLevelPolicy; | 28 class LowLevelPolicy; |
| 29 class TargetProcess; | 29 class TargetProcess; |
| 30 struct PolicyGlobal; | 30 struct PolicyGlobal; |
| 31 | 31 |
| 32 typedef std::vector<HANDLE> HandleList; | 32 typedef std::vector<base::win::ScopedHandle*> HandleList; |
| 33 | 33 |
| 34 // We act as a policy dispatcher, implementing the handler for the "ping" IPC, | 34 // We act as a policy dispatcher, implementing the handler for the "ping" IPC, |
| 35 // so we have to provide the appropriate handler on the OnMessageReady method. | 35 // so we have to provide the appropriate handler on the OnMessageReady method. |
| 36 // There is a static_cast for the handler, and the compiler only performs the | 36 // There is a static_cast for the handler, and the compiler only performs the |
| 37 // cast if the first base class is Dispatcher. | 37 // cast if the first base class is Dispatcher. |
| 38 class PolicyBase : public Dispatcher, public TargetPolicy { | 38 class PolicyBase : public Dispatcher, public TargetPolicy { |
| 39 public: | 39 public: |
| 40 PolicyBase(); | 40 PolicyBase(); |
| 41 | 41 |
| 42 // TargetPolicy: | 42 // TargetPolicy: |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 // Removes a Job object associated with this policy and the target associated | 97 // Removes a Job object associated with this policy and the target associated |
| 98 // with the job. | 98 // with the job. |
| 99 bool OnJobEmpty(HANDLE job); | 99 bool OnJobEmpty(HANDLE job); |
| 100 | 100 |
| 101 EvalResult EvalPolicy(int service, CountedParameterSetBase* params); | 101 EvalResult EvalPolicy(int service, CountedParameterSetBase* params); |
| 102 | 102 |
| 103 HANDLE GetStdoutHandle(); | 103 HANDLE GetStdoutHandle(); |
| 104 HANDLE GetStderrHandle(); | 104 HANDLE GetStderrHandle(); |
| 105 | 105 |
| 106 // Returns the list of handles being shared with the target process. | 106 // Returns the list of handles being shared with the target process. |
| 107 HandleList GetHandlesBeingShared(); | 107 const HandleList& GetHandlesBeingShared(); |
| 108 | 108 |
| 109 // Closes the handles being shared with the target and clears out the list. | 109 // Closes the handles being shared with the target and clears out the list. |
| 110 void ClearSharedHandles(); | 110 void ClearSharedHandles(); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 ~PolicyBase() override; | 113 ~PolicyBase() override; |
| 114 | 114 |
| 115 // Test IPC providers. | 115 // Test IPC providers. |
| 116 bool Ping(IPCInfo* ipc, void* cookie); | 116 bool Ping(IPCInfo* ipc, void* cookie); |
| 117 | 117 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 PSID lowbox_sid_; | 170 PSID lowbox_sid_; |
| 171 base::win::ScopedHandle lowbox_directory_; | 171 base::win::ScopedHandle lowbox_directory_; |
| 172 | 172 |
| 173 static HDESK alternate_desktop_handle_; | 173 static HDESK alternate_desktop_handle_; |
| 174 static HWINSTA alternate_winstation_handle_; | 174 static HWINSTA alternate_winstation_handle_; |
| 175 static IntegrityLevel alternate_desktop_integrity_level_label_; | 175 static IntegrityLevel alternate_desktop_integrity_level_label_; |
| 176 | 176 |
| 177 // Contains the list of handles being shared with the target process. | 177 // Contains the list of handles being shared with the target process. |
| 178 // This list contains handles other than the stderr/stdout handles which are | 178 // This list contains handles other than the stderr/stdout handles which are |
| 179 // shared with the target at times. | 179 // shared with the target at times. |
| 180 std::vector<HANDLE> handles_to_share_; | 180 HandleList handles_to_share_; |
| 181 | 181 |
| 182 DISALLOW_COPY_AND_ASSIGN(PolicyBase); | 182 DISALLOW_COPY_AND_ASSIGN(PolicyBase); |
| 183 }; | 183 }; |
| 184 | 184 |
| 185 } // namespace sandbox | 185 } // namespace sandbox |
| 186 | 186 |
| 187 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ | 187 #endif // SANDBOX_WIN_SRC_SANDBOX_POLICY_BASE_H_ |
| OLD | NEW |