OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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. |
| 4 |
| 5 #ifndef ContentSettingsClient_h |
| 6 #define ContentSettingsClient_h |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "core/CoreExport.h" |
| 11 #include "platform/heap/Heap.h" |
| 12 #include "wtf/Forward.h" |
| 13 |
| 14 namespace blink { |
| 15 |
| 16 class ContentSettingCallbacks; |
| 17 class KURL; |
| 18 class SecurityOrigin; |
| 19 class WebContentSettingsClient; |
| 20 |
| 21 // This class provides the content settings information which tells |
| 22 // whether each feature is allowed. Most of the methods return the |
| 23 // given default values if embedder doesn't provide their own |
| 24 // content settings client implementation (via m_client). |
| 25 class CORE_EXPORT ContentSettingsClient { |
| 26 public: |
| 27 ContentSettingsClient(); |
| 28 |
| 29 void setClient(WebContentSettingsClient* client) { m_client = client; } |
| 30 |
| 31 // Controls whether access to Web Databases is allowed. |
| 32 bool allowDatabase(const String& name, |
| 33 const String& displayName, |
| 34 unsigned estimatedSize); |
| 35 |
| 36 // Controls whether access to File System is allowed for this frame. |
| 37 bool requestFileSystemAccessSync(); |
| 38 |
| 39 // Controls whether access to File System is allowed for this frame. |
| 40 void requestFileSystemAccessAsync(std::unique_ptr<ContentSettingCallbacks>); |
| 41 |
| 42 // Controls whether access to File System is allowed. |
| 43 bool allowIndexedDB(const String& name, SecurityOrigin*); |
| 44 |
| 45 // Controls whether scripts are allowed to execute. |
| 46 bool allowScript(bool enabledPerSettings); |
| 47 |
| 48 // Controls whether scripts loaded from the given URL are allowed to execute. |
| 49 bool allowScriptFromSource(bool enabledPerSettings, const KURL&); |
| 50 |
| 51 // Controls whether plugins are allowed. |
| 52 bool allowPlugins(bool enabledPerSettings); |
| 53 |
| 54 // Controls whether images are allowed. |
| 55 bool allowImage(bool enabledPerSettings, const KURL&); |
| 56 |
| 57 // Controls whether insecure scripts are allowed to execute for this frame. |
| 58 bool allowRunningInsecureContent(bool enabledPerSettings, |
| 59 SecurityOrigin*, |
| 60 const KURL&); |
| 61 |
| 62 // Controls whether HTML5 Web Storage is allowed for this frame. |
| 63 enum class StorageType { kLocal, kSession }; |
| 64 bool allowStorage(StorageType); |
| 65 |
| 66 // Controls whether access to read the clipboard is allowed for this frame. |
| 67 bool allowReadFromClipboard(bool defaultValue); |
| 68 |
| 69 // Controls whether access to write the clipboard is allowed for this frame. |
| 70 bool allowWriteToClipboard(bool defaultValue); |
| 71 |
| 72 // Controls whether to enable MutationEvents for this frame. |
| 73 // The common use case of this method is actually to selectively disable |
| 74 // MutationEvents, but it's been named for consistency with the rest of the |
| 75 // interface. |
| 76 bool allowMutationEvents(bool defaultValue); |
| 77 |
| 78 // Controls whether autoplay is allowed for this frame. |
| 79 bool allowAutoplay(bool defaultValue); |
| 80 |
| 81 // Reports that passive mixed content was found at the provided URL. It may or |
| 82 // may not be actually displayed later, what would be flagged by |
| 83 // didDisplayInsecureContent. |
| 84 void passiveInsecureContentFound(const KURL&); |
| 85 |
| 86 // This callback notifies the client that the frame was about to run |
| 87 // JavaScript but did not because allowScript returned false. We have a |
| 88 // separate callback here because there are a number of places that need to |
| 89 // know if JavaScript is enabled but are not necessarily preparing to execute |
| 90 // script. |
| 91 void didNotAllowScript(); |
| 92 |
| 93 // This callback is similar, but for plugins. |
| 94 void didNotAllowPlugins(); |
| 95 |
| 96 private: |
| 97 WebContentSettingsClient* m_client = nullptr; |
| 98 }; |
| 99 |
| 100 } // namespace blink |
| 101 |
| 102 #endif // ContentSettingsClient_h |
OLD | NEW |