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 COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ |
6 #define COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ | 6 #define COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "third_party/WebKit/public/web/WebContentSettingsClient.h" | 9 #include "third_party/WebKit/public/web/WebContentSettingsClient.h" |
10 | 10 |
11 namespace test_runner { | 11 namespace test_runner { |
12 | 12 |
13 class WebTestDelegate; | 13 class WebTestDelegate; |
14 | 14 |
15 class WebContentSettings : public blink::WebContentSettingsClient { | 15 class WebContentSettings : public blink::WebContentSettingsClient { |
16 public: | 16 public: |
17 WebContentSettings(); | 17 WebContentSettings(); |
18 ~WebContentSettings() override; | 18 ~WebContentSettings() override; |
19 | 19 |
20 // blink::WebContentSettingsClient: | 20 // blink::WebContentSettingsClient: |
21 bool allowImage(bool enabledPerSettings, | 21 bool allowImage(bool enabledPerSettings, |
22 const blink::WebURL& imageURL) override; | 22 const blink::WebURL& imageURL) override; |
23 bool allowMedia(const blink::WebURL& mediaURL) override; | 23 bool allowMedia(const blink::WebURL& mediaURL) override; |
24 bool allowScriptFromSource(bool enabledPerSettings, | 24 bool allowScriptFromSource(bool enabledPerSettings, |
25 const blink::WebURL& scriptURL) override; | 25 const blink::WebURL& scriptURL) override; |
26 bool allowStorage(bool local) override; | 26 bool allowStorage(bool local) override; |
| 27 bool allowKeygen() override; |
27 bool allowPlugins(bool enabledPerSettings) override; | 28 bool allowPlugins(bool enabledPerSettings) override; |
28 bool allowDisplayingInsecureContent(bool enabledPerSettings, | 29 bool allowDisplayingInsecureContent(bool enabledPerSettings, |
29 const blink::WebSecurityOrigin&, | 30 const blink::WebSecurityOrigin&, |
30 const blink::WebURL&) override; | 31 const blink::WebURL&) override; |
31 bool allowRunningInsecureContent(bool enabledPerSettings, | 32 bool allowRunningInsecureContent(bool enabledPerSettings, |
32 const blink::WebSecurityOrigin&, | 33 const blink::WebSecurityOrigin&, |
33 const blink::WebURL&) override; | 34 const blink::WebURL&) override; |
34 | 35 |
35 // Hooks to set the different policies. | 36 // Hooks to set the different policies. |
36 void SetImagesAllowed(bool); | 37 void SetImagesAllowed(bool); |
37 void SetMediaAllowed(bool); | 38 void SetMediaAllowed(bool); |
38 void SetScriptsAllowed(bool); | 39 void SetScriptsAllowed(bool); |
39 void SetStorageAllowed(bool); | 40 void SetStorageAllowed(bool); |
| 41 void SetKeygenAllowed(bool); |
40 void SetPluginsAllowed(bool); | 42 void SetPluginsAllowed(bool); |
41 void SetDisplayingInsecureContentAllowed(bool); | 43 void SetDisplayingInsecureContentAllowed(bool); |
42 void SetRunningInsecureContentAllowed(bool); | 44 void SetRunningInsecureContentAllowed(bool); |
43 | 45 |
44 void SetDelegate(WebTestDelegate*); | 46 void SetDelegate(WebTestDelegate*); |
45 void SetDumpCallbacks(bool); | 47 void SetDumpCallbacks(bool); |
46 | 48 |
47 // Resets the policy to allow everything, except for running insecure content. | 49 // Resets the policy to allow everything, except for running insecure content. |
48 void Reset(); | 50 void Reset(); |
49 | 51 |
50 private: | 52 private: |
51 WebTestDelegate* delegate_; | 53 WebTestDelegate* delegate_; |
52 bool dump_callbacks_; | 54 bool dump_callbacks_; |
53 | 55 |
54 bool images_allowed_; | 56 bool images_allowed_; |
55 bool media_allowed_; | 57 bool media_allowed_; |
56 bool scripts_allowed_; | 58 bool scripts_allowed_; |
57 bool storage_allowed_; | 59 bool storage_allowed_; |
| 60 bool keygen_allowed_; |
58 bool plugins_allowed_; | 61 bool plugins_allowed_; |
59 bool displaying_insecure_content_allowed_; | 62 bool displaying_insecure_content_allowed_; |
60 bool running_insecure_content_allowed_; | 63 bool running_insecure_content_allowed_; |
61 | 64 |
62 DISALLOW_COPY_AND_ASSIGN(WebContentSettings); | 65 DISALLOW_COPY_AND_ASSIGN(WebContentSettings); |
63 }; | 66 }; |
64 | 67 |
65 } // namespace test_runner | 68 } // namespace test_runner |
66 | 69 |
67 #endif // COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ | 70 #endif // COMPONENTS_TEST_RUNNER_WEB_CONTENT_SETTINGS_H_ |
OLD | NEW |