OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_SRC_SANDBOX_POLICY_BASE_H_ | 5 #ifndef SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ |
6 #define SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ | 6 #define SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <list> | 9 #include <list> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class LowLevelPolicy; | 24 class LowLevelPolicy; |
25 struct PolicyGlobal; | 25 struct PolicyGlobal; |
26 | 26 |
27 // We act as a policy dispatcher, implementing the handler for the "ping" IPC, | 27 // We act as a policy dispatcher, implementing the handler for the "ping" IPC, |
28 // so we have to provide the appropriate handler on the OnMessageReady method. | 28 // so we have to provide the appropriate handler on the OnMessageReady method. |
29 // There is a static_cast for the handler, and the compiler only performs the | 29 // There is a static_cast for the handler, and the compiler only performs the |
30 // cast if the first base class is Dispatcher. | 30 // cast if the first base class is Dispatcher. |
31 class PolicyBase : public Dispatcher, public TargetPolicy { | 31 class PolicyBase : public Dispatcher, public TargetPolicy { |
32 public: | 32 public: |
33 PolicyBase(); | 33 PolicyBase(); |
34 ~PolicyBase(); | |
35 | 34 |
36 virtual void AddRef() { | 35 virtual void AddRef() { |
37 ::InterlockedIncrement(&ref_count); | 36 ::InterlockedIncrement(&ref_count); |
38 } | 37 } |
39 | 38 |
40 virtual void Release() { | 39 virtual void Release() { |
41 if (0 == ::InterlockedDecrement(&ref_count)) | 40 if (0 == ::InterlockedDecrement(&ref_count)) |
42 delete this; | 41 delete this; |
43 } | 42 } |
44 | 43 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 116 |
118 // Overrides Dispatcher::OnMessageReady. | 117 // Overrides Dispatcher::OnMessageReady. |
119 virtual Dispatcher* OnMessageReady(IPCParams* ipc, CallbackGeneric* callback); | 118 virtual Dispatcher* OnMessageReady(IPCParams* ipc, CallbackGeneric* callback); |
120 | 119 |
121 // Dispatcher interface. | 120 // Dispatcher interface. |
122 virtual bool SetupService(InterceptionManager* manager, int service); | 121 virtual bool SetupService(InterceptionManager* manager, int service); |
123 | 122 |
124 virtual EvalResult EvalPolicy(int service, CountedParameterSetBase* params); | 123 virtual EvalResult EvalPolicy(int service, CountedParameterSetBase* params); |
125 | 124 |
126 private: | 125 private: |
| 126 ~PolicyBase(); |
| 127 |
127 // Test IPC providers. | 128 // Test IPC providers. |
128 bool Ping(IPCInfo* ipc, void* cookie); | 129 bool Ping(IPCInfo* ipc, void* cookie); |
129 | 130 |
130 // Returns a dispatcher from ipc_targets_. | 131 // Returns a dispatcher from ipc_targets_. |
131 Dispatcher* GetDispatcher(int ipc_tag); | 132 Dispatcher* GetDispatcher(int ipc_tag); |
132 | 133 |
133 // Sets up interceptions for a new target. | 134 // Sets up interceptions for a new target. |
134 bool SetupAllInterceptions(TargetProcess* target); | 135 bool SetupAllInterceptions(TargetProcess* target); |
135 | 136 |
136 // This lock synchronizes operations on the targets_ collection. | 137 // This lock synchronizes operations on the targets_ collection. |
(...skipping 28 matching lines...) Expand all Loading... |
165 | 166 |
166 static HDESK alternate_desktop_handle_; | 167 static HDESK alternate_desktop_handle_; |
167 static HWINSTA alternate_winstation_handle_; | 168 static HWINSTA alternate_winstation_handle_; |
168 | 169 |
169 DISALLOW_COPY_AND_ASSIGN(PolicyBase); | 170 DISALLOW_COPY_AND_ASSIGN(PolicyBase); |
170 }; | 171 }; |
171 | 172 |
172 } // namespace sandbox | 173 } // namespace sandbox |
173 | 174 |
174 #endif // SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ | 175 #endif // SANDBOX_SRC_SANDBOX_POLICY_BASE_H_ |
OLD | NEW |