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.
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_
8 #include "base/macros.h"
9 #include "third_party/WebKit/public/web/WebFrame.h"
10 #include "third_party/WebKit/public/web/WebPermissionClient.h"
14 class WebTestDelegate;
16 class WebPermissions : public blink::WebPermissionClient {
19 virtual ~WebPermissions();
21 // Override WebPermissionClient methods.
22 virtual bool allowImage(bool enabledPerSettings, const blink::WebURL& imageURL);
23 virtual bool allowScriptFromSource(bool enabledPerSettings, const blink::WebURL& scriptURL);
24 virtual bool allowStorage(bool local);
25 virtual bool allowPlugins(bool enabledPerSettings);
26 virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&);
27 virtual bool allowRunningInsecureContent(bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&);
29 // Hooks to set the different policies.
30 void setImagesAllowed(bool);
31 void setScriptsAllowed(bool);
32 void setStorageAllowed(bool);
33 void setPluginsAllowed(bool);
34 void setDisplayingInsecureContentAllowed(bool);
35 void setRunningInsecureContentAllowed(bool);
37 // Resets the policy to allow everything, except for running insecure content.
40 void setDelegate(WebTestDelegate*);
41 void setDumpCallbacks(bool);
44 WebTestDelegate* m_delegate;
48 bool m_scriptsAllowed;
49 bool m_storageAllowed;
50 bool m_pluginsAllowed;
51 bool m_displayingInsecureContentAllowed;
52 bool m_runningInsecureContentAllowed;
54 DISALLOW_COPY_AND_ASSIGN(WebPermissions);
57 } // namespace content
59 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_