| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebPermissionClient_h | 31 #ifndef WebPermissionClient_h |
| 32 #define WebPermissionClient_h | 32 #define WebPermissionClient_h |
| 33 | 33 |
| 34 #include "WebFrame.h" | |
| 35 | |
| 36 namespace blink { | 34 namespace blink { |
| 37 | 35 |
| 38 class WebDocument; | 36 class WebDocument; |
| 37 class WebFrame; |
| 39 class WebPermissionCallbacks; | 38 class WebPermissionCallbacks; |
| 40 class WebSecurityOrigin; | 39 class WebSecurityOrigin; |
| 41 class WebString; | 40 class WebString; |
| 42 class WebURL; | 41 class WebURL; |
| 43 | 42 |
| 44 class WebPermissionClient { | 43 class WebPermissionClient { |
| 45 public: | 44 public: |
| 46 // Controls whether access to Web Databases is allowed for this frame. | 45 // Controls whether access to Web Databases is allowed for this frame. |
| 47 virtual bool allowDatabase(WebLocalFrame*, const WebString& name, const WebS
tring& displayName, unsigned long estimatedSize) { return true; } | 46 virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString
& displayName, unsigned long estimatedSize) { return true; } |
| 48 | 47 |
| 49 // Controls whether access to File System is allowed for this frame. | 48 // Controls whether access to File System is allowed for this frame. |
| 50 virtual bool allowFileSystem(WebLocalFrame*) { return true; } | 49 virtual bool allowFileSystem(WebFrame*) { return true; } |
| 51 | 50 |
| 52 virtual void requestFileSystemAccess(WebFrame* frame, const WebPermissionCal
lbacks& callbacks) { } | 51 virtual void requestFileSystemAccess(WebFrame* frame, const WebPermissionCal
lbacks& callbacks) { } |
| 53 | 52 |
| 54 // Controls whether images are allowed for this frame. | 53 // Controls whether images are allowed for this frame. |
| 55 virtual bool allowImage(WebLocalFrame* frame, bool enabledPerSettings, const
WebURL& imageURL) { return enabledPerSettings; } | 54 virtual bool allowImage(WebFrame* frame, bool enabledPerSettings, const WebU
RL& imageURL) { return enabledPerSettings; } |
| 56 | 55 |
| 57 // Controls whether access to Indexed DB are allowed for this frame. | 56 // Controls whether access to Indexed DB are allowed for this frame. |
| 58 virtual bool allowIndexedDB(WebLocalFrame*, const WebString& name, const Web
SecurityOrigin&) { return true; } | 57 virtual bool allowIndexedDB(WebFrame*, const WebString& name, const WebSecur
ityOrigin&) { return true; } |
| 59 | 58 |
| 60 // Controls whether plugins are allowed for this frame. | 59 // Controls whether plugins are allowed for this frame. |
| 61 virtual bool allowPlugins(WebLocalFrame*, bool enabledPerSettings) { return
enabledPerSettings; } | 60 virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabl
edPerSettings; } |
| 62 | 61 |
| 63 // Controls whether scripts are allowed to execute for this frame. | 62 // Controls whether scripts are allowed to execute for this frame. |
| 64 virtual bool allowScript(WebLocalFrame*, bool enabledPerSettings) { return e
nabledPerSettings; } | 63 virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enable
dPerSettings; } |
| 65 | 64 |
| 66 // Controls whether scripts loaded from the given URL are allowed to execute
for this frame. | 65 // Controls whether scripts loaded from the given URL are allowed to execute
for this frame. |
| 67 virtual bool allowScriptFromSource(WebLocalFrame*, bool enabledPerSettings,
const WebURL& scriptURL) { return enabledPerSettings; } | 66 virtual bool allowScriptFromSource(WebFrame*, bool enabledPerSettings, const
WebURL& scriptURL) { return enabledPerSettings; } |
| 68 | 67 |
| 69 // Controls whether insecrure content is allowed to display for this frame. | 68 // Controls whether insecrure content is allowed to display for this frame. |
| 70 virtual bool allowDisplayingInsecureContent(WebLocalFrame*, bool enabledPerS
ettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } | 69 virtual bool allowDisplayingInsecureContent(WebFrame*, bool enabledPerSettin
gs, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } |
| 71 | 70 |
| 72 // Controls whether insecrure scripts are allowed to execute for this frame. | 71 // Controls whether insecrure scripts are allowed to execute for this frame. |
| 73 virtual bool allowRunningInsecureContent(WebLocalFrame*, bool enabledPerSett
ings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } | 72 virtual bool allowRunningInsecureContent(WebFrame*, bool enabledPerSettings,
const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } |
| 74 | 73 |
| 75 // Controls whether the given script extension should run in a new script | 74 // Controls whether the given script extension should run in a new script |
| 76 // context in this frame. If extensionGroup is 0, the script context is the | 75 // context in this frame. If extensionGroup is 0, the script context is the |
| 77 // frame's main context. Otherwise, it is a context created by | 76 // frame's main context. Otherwise, it is a context created by |
| 78 // WebLocalFrame::executeScriptInIsolatedWorld with that same extensionGroup | 77 // WebFrame::executeScriptInIsolatedWorld with that same extensionGroup |
| 79 // value. | 78 // value. |
| 80 virtual bool allowScriptExtension(WebLocalFrame*, const WebString& extension
Name, int extensionGroup) { return true; } | 79 virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName,
int extensionGroup) { return true; } |
| 81 | 80 |
| 82 virtual bool allowScriptExtension(WebLocalFrame* webFrame, const WebString&
extensionName, int extensionGroup, int worldId) | 81 virtual bool allowScriptExtension(WebFrame* webFrame, const WebString& exten
sionName, int extensionGroup, int worldId) |
| 83 { | 82 { |
| 84 return allowScriptExtension(webFrame, extensionName, extensionGroup); | 83 return allowScriptExtension(webFrame, extensionName, extensionGroup); |
| 85 } | 84 } |
| 86 | 85 |
| 87 // Controls whether HTML5 Web Storage is allowed for this frame. | 86 // Controls whether HTML5 Web Storage is allowed for this frame. |
| 88 // If local is true, then this is for local storage, otherwise it's for sess
ion storage. | 87 // If local is true, then this is for local storage, otherwise it's for sess
ion storage. |
| 89 virtual bool allowStorage(WebLocalFrame*, bool local) { return true; } | 88 virtual bool allowStorage(WebFrame*, bool local) { return true; } |
| 90 | 89 |
| 91 // Controls whether access to read the clipboard is allowed for this frame. | 90 // Controls whether access to read the clipboard is allowed for this frame. |
| 92 virtual bool allowReadFromClipboard(WebLocalFrame*, bool defaultValue) { ret
urn defaultValue; } | 91 virtual bool allowReadFromClipboard(WebFrame*, bool defaultValue) { return d
efaultValue; } |
| 93 | 92 |
| 94 // Controls whether access to write the clipboard is allowed for this frame. | 93 // Controls whether access to write the clipboard is allowed for this frame. |
| 95 virtual bool allowWriteToClipboard(WebLocalFrame*, bool defaultValue) { retu
rn defaultValue; } | 94 virtual bool allowWriteToClipboard(WebFrame*, bool defaultValue) { return de
faultValue; } |
| 96 | 95 |
| 97 // Controls whether enabling Web Components API for this frame. | 96 // Controls whether enabling Web Components API for this frame. |
| 98 virtual bool allowWebComponents(WebLocalFrame*, bool defaultValue) { return
defaultValue; } | 97 virtual bool allowWebComponents(WebFrame*, bool defaultValue) { return defau
ltValue; } |
| 99 | 98 |
| 100 // Controls whether to enable MutationEvents for this frame. | 99 // Controls whether to enable MutationEvents for this frame. |
| 101 // The common use case of this method is actually to selectively disable Mut
ationEvents, | 100 // The common use case of this method is actually to selectively disable Mut
ationEvents, |
| 102 // but it's been named for consistency with the rest of the interface. | 101 // but it's been named for consistency with the rest of the interface. |
| 103 virtual bool allowMutationEvents(WebLocalFrame*, bool defaultValue) { return
defaultValue; } | 102 virtual bool allowMutationEvents(WebFrame*, bool defaultValue) { return defa
ultValue; } |
| 104 | 103 |
| 105 // Controls whether pushState and related History APIs are enabled for this
frame. | 104 // Controls whether pushState and related History APIs are enabled for this
frame. |
| 106 virtual bool allowPushState(WebLocalFrame*) { return true; } | 105 virtual bool allowPushState(WebFrame*) { return true; } |
| 107 | 106 |
| 108 // Notifies the client that the frame would have instantiated a plug-in if p
lug-ins were enabled. | 107 // Notifies the client that the frame would have instantiated a plug-in if p
lug-ins were enabled. |
| 109 virtual void didNotAllowPlugins(WebLocalFrame*) { } | 108 virtual void didNotAllowPlugins(WebFrame*) { } |
| 110 | 109 |
| 111 // Notifies the client that the frame would have executed script if script w
ere enabled. | 110 // Notifies the client that the frame would have executed script if script w
ere enabled. |
| 112 virtual void didNotAllowScript(WebLocalFrame*) { } | 111 virtual void didNotAllowScript(WebFrame*) { } |
| 113 | 112 |
| 114 protected: | 113 protected: |
| 115 ~WebPermissionClient() { } | 114 ~WebPermissionClient() { } |
| 116 }; | 115 }; |
| 117 | 116 |
| 118 } // namespace blink | 117 } // namespace blink |
| 119 | 118 |
| 120 #endif | 119 #endif |
| OLD | NEW |