OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_ | |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "third_party/WebKit/public/web/WebFrame.h" | |
10 #include "third_party/WebKit/public/web/WebPermissionClient.h" | |
11 | |
12 namespace content { | |
13 | |
14 class WebTestDelegate; | |
15 | |
16 class WebPermissions : public blink::WebPermissionClient { | |
17 public: | |
18 WebPermissions(); | |
19 virtual ~WebPermissions(); | |
20 | |
21 // Override WebPermissionClient methods. | |
22 virtual bool allowImage(bool enabledPerSettings, const blink::WebURL& imageU
RL); | |
23 virtual bool allowMedia(const blink::WebURL& mediaURL); | |
24 virtual bool allowScriptFromSource(bool enabledPerSettings, const blink::Web
URL& scriptURL); | |
25 virtual bool allowStorage(bool local); | |
26 virtual bool allowPlugins(bool enabledPerSettings); | |
27 virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, const b
link::WebSecurityOrigin&, const blink::WebURL&); | |
28 virtual bool allowRunningInsecureContent(bool enabledPerSettings, const blin
k::WebSecurityOrigin&, const blink::WebURL&); | |
29 | |
30 // Hooks to set the different policies. | |
31 void setImagesAllowed(bool); | |
32 void setMediaAllowed(bool); | |
33 void setScriptsAllowed(bool); | |
34 void setStorageAllowed(bool); | |
35 void setPluginsAllowed(bool); | |
36 void setDisplayingInsecureContentAllowed(bool); | |
37 void setRunningInsecureContentAllowed(bool); | |
38 | |
39 // Resets the policy to allow everything, except for running insecure conten
t. | |
40 void reset(); | |
41 | |
42 void setDelegate(WebTestDelegate*); | |
43 void setDumpCallbacks(bool); | |
44 | |
45 private: | |
46 WebTestDelegate* m_delegate; | |
47 bool m_dumpCallbacks; | |
48 | |
49 bool m_imagesAllowed; | |
50 bool m_mediaAllowed; | |
51 bool m_scriptsAllowed; | |
52 bool m_storageAllowed; | |
53 bool m_pluginsAllowed; | |
54 bool m_displayingInsecureContentAllowed; | |
55 bool m_runningInsecureContentAllowed; | |
56 | |
57 DISALLOW_COPY_AND_ASSIGN(WebPermissions); | |
58 }; | |
59 | |
60 } // namespace content | |
61 | |
62 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_ | |
OLD | NEW |