| 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 |
| 34 namespace blink { | 36 namespace blink { |
| 35 | 37 |
| 36 class WebDocument; | 38 class WebDocument; |
| 37 class WebFrame; | |
| 38 class WebPermissionCallbacks; | 39 class WebPermissionCallbacks; |
| 39 class WebSecurityOrigin; | 40 class WebSecurityOrigin; |
| 40 class WebString; | 41 class WebString; |
| 41 class WebURL; | 42 class WebURL; |
| 42 | 43 |
| 43 class WebPermissionClient { | 44 class WebPermissionClient { |
| 44 public: | 45 public: |
| 45 // Controls whether access to Web Databases is allowed for this frame. | 46 // Controls whether access to Web Databases is allowed for this frame. |
| 46 virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString
& displayName, unsigned long estimatedSize) { return true; } | 47 virtual bool allowDatabase(WebLocalFrame*, const WebString& name, const WebS
tring& displayName, unsigned long estimatedSize) { return true; } |
| 47 | 48 |
| 48 // Controls whether access to File System is allowed for this frame. | 49 // Controls whether access to File System is allowed for this frame. |
| 49 virtual bool allowFileSystem(WebFrame*) { return true; } | 50 virtual bool allowFileSystem(WebLocalFrame*) { return true; } |
| 50 | 51 |
| 51 virtual void requestFileSystemAccess(WebFrame* frame, const WebPermissionCal
lbacks& callbacks) { } | 52 virtual void requestFileSystemAccess(WebFrame* frame, const WebPermissionCal
lbacks& callbacks) { } |
| 52 | 53 |
| 53 // Controls whether images are allowed for this frame. | 54 // Controls whether images are allowed for this frame. |
| 54 virtual bool allowImage(WebFrame* frame, bool enabledPerSettings, const WebU
RL& imageURL) { return enabledPerSettings; } | 55 virtual bool allowImage(WebLocalFrame* frame, bool enabledPerSettings, const
WebURL& imageURL) { return enabledPerSettings; } |
| 55 | 56 |
| 56 // Controls whether access to Indexed DB are allowed for this frame. | 57 // Controls whether access to Indexed DB are allowed for this frame. |
| 57 virtual bool allowIndexedDB(WebFrame*, const WebString& name, const WebSecur
ityOrigin&) { return true; } | 58 virtual bool allowIndexedDB(WebLocalFrame*, const WebString& name, const Web
SecurityOrigin&) { return true; } |
| 58 | 59 |
| 59 // Controls whether plugins are allowed for this frame. | 60 // Controls whether plugins are allowed for this frame. |
| 60 virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabl
edPerSettings; } | 61 virtual bool allowPlugins(WebLocalFrame*, bool enabledPerSettings) { return
enabledPerSettings; } |
| 61 | 62 |
| 62 // Controls whether scripts are allowed to execute for this frame. | 63 // Controls whether scripts are allowed to execute for this frame. |
| 63 virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enable
dPerSettings; } | 64 virtual bool allowScript(WebLocalFrame*, bool enabledPerSettings) { return e
nabledPerSettings; } |
| 64 | 65 |
| 65 // Controls whether scripts loaded from the given URL are allowed to execute
for this frame. | 66 // Controls whether scripts loaded from the given URL are allowed to execute
for this frame. |
| 66 virtual bool allowScriptFromSource(WebFrame*, bool enabledPerSettings, const
WebURL& scriptURL) { return enabledPerSettings; } | 67 virtual bool allowScriptFromSource(WebLocalFrame*, bool enabledPerSettings,
const WebURL& scriptURL) { return enabledPerSettings; } |
| 67 | 68 |
| 68 // Controls whether insecrure content is allowed to display for this frame. | 69 // Controls whether insecrure content is allowed to display for this frame. |
| 69 virtual bool allowDisplayingInsecureContent(WebFrame*, bool enabledPerSettin
gs, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } | 70 virtual bool allowDisplayingInsecureContent(WebLocalFrame*, bool enabledPerS
ettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } |
| 70 | 71 |
| 71 // Controls whether insecrure scripts are allowed to execute for this frame. | 72 // Controls whether insecrure scripts are allowed to execute for this frame. |
| 72 virtual bool allowRunningInsecureContent(WebFrame*, bool enabledPerSettings,
const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } | 73 virtual bool allowRunningInsecureContent(WebLocalFrame*, bool enabledPerSett
ings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } |
| 73 | 74 |
| 74 // Controls whether the given script extension should run in a new script | 75 // Controls whether the given script extension should run in a new script |
| 75 // context in this frame. If extensionGroup is 0, the script context is the | 76 // context in this frame. If extensionGroup is 0, the script context is the |
| 76 // frame's main context. Otherwise, it is a context created by | 77 // frame's main context. Otherwise, it is a context created by |
| 77 // WebFrame::executeScriptInIsolatedWorld with that same extensionGroup | 78 // WebLocalFrame::executeScriptInIsolatedWorld with that same extensionGroup |
| 78 // value. | 79 // value. |
| 79 virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName,
int extensionGroup) { return true; } | 80 virtual bool allowScriptExtension(WebLocalFrame*, const WebString& extension
Name, int extensionGroup) { return true; } |
| 80 | 81 |
| 81 virtual bool allowScriptExtension(WebFrame* webFrame, const WebString& exten
sionName, int extensionGroup, int worldId) | 82 virtual bool allowScriptExtension(WebLocalFrame* webFrame, const WebString&
extensionName, int extensionGroup, int worldId) |
| 82 { | 83 { |
| 83 return allowScriptExtension(webFrame, extensionName, extensionGroup); | 84 return allowScriptExtension(webFrame, extensionName, extensionGroup); |
| 84 } | 85 } |
| 85 | 86 |
| 86 // Controls whether HTML5 Web Storage is allowed for this frame. | 87 // Controls whether HTML5 Web Storage is allowed for this frame. |
| 87 // If local is true, then this is for local storage, otherwise it's for sess
ion storage. | 88 // If local is true, then this is for local storage, otherwise it's for sess
ion storage. |
| 88 virtual bool allowStorage(WebFrame*, bool local) { return true; } | 89 virtual bool allowStorage(WebLocalFrame*, bool local) { return true; } |
| 89 | 90 |
| 90 // Controls whether access to read the clipboard is allowed for this frame. | 91 // Controls whether access to read the clipboard is allowed for this frame. |
| 91 virtual bool allowReadFromClipboard(WebFrame*, bool defaultValue) { return d
efaultValue; } | 92 virtual bool allowReadFromClipboard(WebLocalFrame*, bool defaultValue) { ret
urn defaultValue; } |
| 92 | 93 |
| 93 // Controls whether access to write the clipboard is allowed for this frame. | 94 // Controls whether access to write the clipboard is allowed for this frame. |
| 94 virtual bool allowWriteToClipboard(WebFrame*, bool defaultValue) { return de
faultValue; } | 95 virtual bool allowWriteToClipboard(WebLocalFrame*, bool defaultValue) { retu
rn defaultValue; } |
| 95 | 96 |
| 96 // Controls whether enabling Web Components API for this frame. | 97 // Controls whether enabling Web Components API for this frame. |
| 97 virtual bool allowWebComponents(WebFrame*, bool defaultValue) { return defau
ltValue; } | 98 virtual bool allowWebComponents(WebLocalFrame*, bool defaultValue) { return
defaultValue; } |
| 98 | 99 |
| 99 // Controls whether to enable MutationEvents for this frame. | 100 // Controls whether to enable MutationEvents for this frame. |
| 100 // The common use case of this method is actually to selectively disable Mut
ationEvents, | 101 // The common use case of this method is actually to selectively disable Mut
ationEvents, |
| 101 // but it's been named for consistency with the rest of the interface. | 102 // but it's been named for consistency with the rest of the interface. |
| 102 virtual bool allowMutationEvents(WebFrame*, bool defaultValue) { return defa
ultValue; } | 103 virtual bool allowMutationEvents(WebLocalFrame*, bool defaultValue) { return
defaultValue; } |
| 103 | 104 |
| 104 // Controls whether pushState and related History APIs are enabled for this
frame. | 105 // Controls whether pushState and related History APIs are enabled for this
frame. |
| 105 virtual bool allowPushState(WebFrame*) { return true; } | 106 virtual bool allowPushState(WebLocalFrame*) { return true; } |
| 106 | 107 |
| 107 // Notifies the client that the frame would have instantiated a plug-in if p
lug-ins were enabled. | 108 // Notifies the client that the frame would have instantiated a plug-in if p
lug-ins were enabled. |
| 108 virtual void didNotAllowPlugins(WebFrame*) { } | 109 virtual void didNotAllowPlugins(WebLocalFrame*) { } |
| 109 | 110 |
| 110 // Notifies the client that the frame would have executed script if script w
ere enabled. | 111 // Notifies the client that the frame would have executed script if script w
ere enabled. |
| 111 virtual void didNotAllowScript(WebFrame*) { } | 112 virtual void didNotAllowScript(WebLocalFrame*) { } |
| 112 | 113 |
| 113 protected: | 114 protected: |
| 114 ~WebPermissionClient() { } | 115 ~WebPermissionClient() { } |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 } // namespace blink | 118 } // namespace blink |
| 118 | 119 |
| 119 #endif | 120 #endif |
| OLD | NEW |