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