Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / public / web / WebContentSettingsClient.h
blobdc957e1f5e4cde1cf2e9410ca3ec9c45f9033698
1 // Copyright 2015 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 WebContentSettingsClient_h
6 #define WebContentSettingsClient_h
8 #include "public/platform/WebContentSettingCallbacks.h"
10 namespace blink {
12 class WebSecurityOrigin;
13 class WebString;
14 class WebURL;
16 class WebContentSettingsClient {
17 public:
18 // Controls whether access to Web Databases is allowed for this frame.
19 virtual bool allowDatabase(const WebString& name, const WebString& displayName, unsigned long estimatedSize) { return true; }
21 // Controls whether access to File System is allowed for this frame.
22 virtual bool requestFileSystemAccessSync() { return true; }
24 // Controls whether access to File System is allowed for this frame.
25 virtual void requestFileSystemAccessAsync(const WebContentSettingCallbacks& callbacks) { WebContentSettingCallbacks permissionCallbacks(callbacks); permissionCallbacks.doAllow(); }
27 // Controls whether images are allowed for this frame.
28 virtual bool allowImage(bool enabledPerSettings, const WebURL& imageURL) { return enabledPerSettings; }
30 // Controls whether access to Indexed DB are allowed for this frame.
31 virtual bool allowIndexedDB(const WebString& name, const WebSecurityOrigin&) { return true; }
33 // Controls whether HTML5 media elements (<audio>, <video>) are allowed for this frame.
34 virtual bool allowMedia(const WebURL& videoURL) { return true; }
36 // Controls whether plugins are allowed for this frame.
37 virtual bool allowPlugins(bool enabledPerSettings) { return enabledPerSettings; }
39 // Controls whether scripts are allowed to execute for this frame.
40 virtual bool allowScript(bool enabledPerSettings) { return enabledPerSettings; }
42 // Controls whether scripts loaded from the given URL are allowed to execute for this frame.
43 virtual bool allowScriptFromSource(bool enabledPerSettings, const WebURL& scriptURL) { return enabledPerSettings; }
45 // Controls whether insecrure content is allowed to display for this frame.
46 virtual bool allowDisplayingInsecureContent(bool enabledPerSettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; }
48 // Controls whether insecrure scripts are allowed to execute for this frame.
49 virtual bool allowRunningInsecureContent(bool enabledPerSettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; }
51 // Controls whether the given script extension should run in a new script
52 // context in this frame. If extensionGroup is 0, the script context is the
53 // frame's main context. Otherwise, it is a context created by
54 // WebLocalFrame::executeScriptInIsolatedWorld with that same extensionGroup
55 // value.
56 virtual bool allowScriptExtension(const WebString& extensionName, int extensionGroup) { return true; }
58 virtual bool allowScriptExtension(const WebString& extensionName, int extensionGroup, int worldId)
60 return allowScriptExtension(extensionName, extensionGroup);
63 // Controls whether HTML5 Web Storage is allowed for this frame.
64 // If local is true, then this is for local storage, otherwise it's for session storage.
65 virtual bool allowStorage(bool local) { return true; }
67 // Controls whether access to read the clipboard is allowed for this frame.
68 virtual bool allowReadFromClipboard(bool defaultValue) { return defaultValue; }
70 // Controls whether access to write the clipboard is allowed for this frame.
71 virtual bool allowWriteToClipboard(bool defaultValue) { return defaultValue; }
73 // Controls whether enabling Web Components API for this frame.
74 virtual bool allowWebComponents(bool defaultValue) { return defaultValue; }
76 // Controls whether to enable MutationEvents for this frame.
77 // The common use case of this method is actually to selectively disable MutationEvents,
78 // but it's been named for consistency with the rest of the interface.
79 virtual bool allowMutationEvents(bool defaultValue) { return defaultValue; }
81 // Notifies the client that the frame would have instantiated a plugin if plugins were enabled.
82 virtual void didNotAllowPlugins() { }
84 // Notifies the client that the frame would have executed script if script were enabled.
85 virtual void didNotAllowScript() { }
87 virtual ~WebContentSettingsClient() { }
90 } // namespace blink
92 #endif // WebContentSettingsClient_h