OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ScriptForbiddenScope_h | 5 #ifndef ScriptForbiddenScope_h |
6 #define ScriptForbiddenScope_h | 6 #define ScriptForbiddenScope_h |
7 | 7 |
| 8 #include "wtf/Assertions.h" |
8 #include "wtf/TemporaryChange.h" | 9 #include "wtf/TemporaryChange.h" |
9 | 10 |
10 namespace WebCore { | 11 namespace WebCore { |
11 | 12 |
12 #if ASSERT_DISABLED | 13 #if ASSERT_ENABLED |
13 | 14 |
14 class ScriptForbiddenScope { | 15 class ScriptForbiddenScope { |
15 public: | 16 public: |
16 ScriptForbiddenScope() { } | |
17 class AllowUserAgentScript { | |
18 public: | |
19 AllowUserAgentScript() { } | |
20 }; | |
21 static bool isScriptForbidden() { return false; } | |
22 }; | |
23 | |
24 #else | |
25 | |
26 class ScriptForbiddenScope { | |
27 public: | |
28 ScriptForbiddenScope(); | 17 ScriptForbiddenScope(); |
29 ~ScriptForbiddenScope(); | 18 ~ScriptForbiddenScope(); |
30 | 19 |
31 class AllowUserAgentScript { | 20 class AllowUserAgentScript { |
32 public: | 21 public: |
33 AllowUserAgentScript(); | 22 AllowUserAgentScript(); |
34 ~AllowUserAgentScript(); | 23 ~AllowUserAgentScript(); |
35 private: | 24 private: |
36 TemporaryChange<unsigned> m_change; | 25 TemporaryChange<unsigned> m_change; |
37 }; | 26 }; |
38 | 27 |
39 static bool isScriptForbidden(); | 28 static bool isScriptForbidden(); |
40 }; | 29 }; |
41 | 30 |
| 31 #else |
| 32 |
| 33 class ScriptForbiddenScope { |
| 34 public: |
| 35 ScriptForbiddenScope() { } |
| 36 class AllowUserAgentScript { |
| 37 public: |
| 38 AllowUserAgentScript() { } |
| 39 }; |
| 40 static bool isScriptForbidden() { return false; } |
| 41 }; |
| 42 |
42 #endif | 43 #endif |
43 | 44 |
44 } // namespace WebCore | 45 } // namespace WebCore |
45 | 46 |
46 #endif // ScriptForbiddenScope_h | 47 #endif // ScriptForbiddenScope_h |
OLD | NEW |