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