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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_
6 #define COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_
8 #include "base/macros.h"
9 #include "third_party/WebKit/public/web/WebContentSettingsClient.h"
11 namespace test_runner
{
13 class WebTestDelegate
;
15 class WebContentSettings
: public blink::WebContentSettingsClient
{
18 virtual ~WebContentSettings();
20 // blink::WebContentSettingsClient:
21 virtual bool allowImage(bool enabledPerSettings
,
22 const blink::WebURL
& imageURL
);
23 virtual bool allowMedia(const blink::WebURL
& mediaURL
);
24 virtual bool allowScriptFromSource(bool enabledPerSettings
,
25 const blink::WebURL
& scriptURL
);
26 virtual bool allowStorage(bool local
);
27 virtual bool allowPlugins(bool enabledPerSettings
);
28 virtual bool allowDisplayingInsecureContent(bool enabledPerSettings
,
29 const blink::WebSecurityOrigin
&,
30 const blink::WebURL
&);
31 virtual bool allowRunningInsecureContent(bool enabledPerSettings
,
32 const blink::WebSecurityOrigin
&,
33 const blink::WebURL
&);
35 // Hooks to set the different policies.
36 void SetImagesAllowed(bool);
37 void SetMediaAllowed(bool);
38 void SetScriptsAllowed(bool);
39 void SetStorageAllowed(bool);
40 void SetPluginsAllowed(bool);
41 void SetDisplayingInsecureContentAllowed(bool);
42 void SetRunningInsecureContentAllowed(bool);
44 void SetDelegate(WebTestDelegate
*);
45 void SetDumpCallbacks(bool);
47 // Resets the policy to allow everything, except for running insecure content.
51 WebTestDelegate
* delegate_
;
56 bool scripts_allowed_
;
57 bool storage_allowed_
;
58 bool plugins_allowed_
;
59 bool displaying_insecure_content_allowed_
;
60 bool running_insecure_content_allowed_
;
62 DISALLOW_COPY_AND_ASSIGN(WebContentSettings
);
65 } // namespace test_runner
67 #endif // COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_