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"
12 namespace WebTestRunner
{
13 class WebTestDelegate
;
18 class WebPermissions
: public blink::WebPermissionClient
{
21 virtual ~WebPermissions();
23 // Override WebPermissionClient methods.
24 virtual bool allowImage(bool enabledPerSettings
, const blink::WebURL
& imageURL
);
25 virtual bool allowScriptFromSource(bool enabledPerSettings
, const blink::WebURL
& scriptURL
);
26 virtual bool allowStorage(bool local
);
27 virtual bool allowPlugins(bool enabledPerSettings
);
28 virtual bool allowDisplayingInsecureContent(bool enabledPerSettings
, const blink::WebSecurityOrigin
&, const blink::WebURL
&);
29 virtual bool allowRunningInsecureContent(bool enabledPerSettings
, const blink::WebSecurityOrigin
&, const blink::WebURL
&);
31 // Hooks to set the different policies.
32 void setImagesAllowed(bool);
33 void setScriptsAllowed(bool);
34 void setStorageAllowed(bool);
35 void setPluginsAllowed(bool);
36 void setDisplayingInsecureContentAllowed(bool);
37 void setRunningInsecureContentAllowed(bool);
39 // Resets the policy to allow everything, except for running insecure content.
42 void setDelegate(WebTestRunner::WebTestDelegate
*);
43 void setDumpCallbacks(bool);
46 WebTestRunner::WebTestDelegate
* m_delegate
;
50 bool m_scriptsAllowed
;
51 bool m_storageAllowed
;
52 bool m_pluginsAllowed
;
53 bool m_displayingInsecureContentAllowed
;
54 bool m_runningInsecureContentAllowed
;
56 DISALLOW_COPY_AND_ASSIGN(WebPermissions
);
59 } // namespace content
61 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEBPERMISSIONS_H_