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