Index: content/shell/renderer/test_runner/WebPermissions.h |
diff --git a/content/shell/renderer/test_runner/WebPermissions.h b/content/shell/renderer/test_runner/WebPermissions.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f9294cd73ea749fb003cd18a04b1da0aa2e39c26 |
--- /dev/null |
+++ b/content/shell/renderer/test_runner/WebPermissions.h |
@@ -0,0 +1,56 @@ |
+// Copyright 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef WebPermissions_h |
+#define WebPermissions_h |
+ |
+#include "third_party/WebKit/public/platform/WebNonCopyable.h" |
+#include "third_party/WebKit/public/web/WebPermissionClient.h" |
+ |
+namespace WebTestRunner { |
+ |
+class WebTestDelegate; |
+ |
+class WebPermissions : public blink::WebPermissionClient, public blink::WebNonCopyable { |
+public: |
+ WebPermissions(); |
+ virtual ~WebPermissions(); |
+ |
+ // Override WebPermissionClient methods. |
+ virtual bool allowImage(blink::WebFrame*, bool enabledPerSettings, const blink::WebURL& imageURL); |
+ virtual bool allowScriptFromSource(blink::WebFrame*, bool enabledPerSettings, const blink::WebURL& scriptURL); |
+ virtual bool allowStorage(blink::WebFrame*, bool local); |
+ virtual bool allowPlugins(blink::WebFrame*, bool enabledPerSettings); |
+ virtual bool allowDisplayingInsecureContent(blink::WebFrame*, bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&); |
+ virtual bool allowRunningInsecureContent(blink::WebFrame*, bool enabledPerSettings, const blink::WebSecurityOrigin&, const blink::WebURL&); |
+ |
+ // Hooks to set the different policies. |
+ void setImagesAllowed(bool); |
+ void setScriptsAllowed(bool); |
+ void setStorageAllowed(bool); |
+ void setPluginsAllowed(bool); |
+ void setDisplayingInsecureContentAllowed(bool); |
+ void setRunningInsecureContentAllowed(bool); |
+ |
+ // Resets the policy to allow everything, except for running insecure content. |
+ void reset(); |
+ |
+ void setDelegate(WebTestDelegate*); |
+ void setDumpCallbacks(bool); |
+ |
+private: |
+ WebTestDelegate* m_delegate; |
+ bool m_dumpCallbacks; |
+ |
+ bool m_imagesAllowed; |
+ bool m_scriptsAllowed; |
+ bool m_storageAllowed; |
+ bool m_pluginsAllowed; |
+ bool m_displayingInsecureContentAllowed; |
+ bool m_runningInsecureContentAllowed; |
+}; |
+ |
+} |
+ |
+#endif |