Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Unified Diff: third_party/WebKit/Source/core/frame/ContentSettingsClient.h

Issue 2786673002: Separate ContentSettingsClient out from LocalFrameClient (Closed)
Patch Set: fix Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/frame/ContentSettingsClient.h
diff --git a/third_party/WebKit/Source/core/frame/ContentSettingsClient.h b/third_party/WebKit/Source/core/frame/ContentSettingsClient.h
new file mode 100644
index 0000000000000000000000000000000000000000..567956b5296cb94a8b21007e1e2a514e21b123b3
--- /dev/null
+++ b/third_party/WebKit/Source/core/frame/ContentSettingsClient.h
@@ -0,0 +1,103 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ContentSettingsClient_h
+#define ContentSettingsClient_h
+
+#include <memory>
+
+#include "core/CoreExport.h"
+#include "platform/heap/Heap.h"
+#include "wtf/Forward.h"
+
+namespace blink {
+
+class ContentSettingCallbacks;
+class KURL;
+class SecurityOrigin;
+class WebContentSettingsClient;
+
+// This class provides the content settings information which tells
+// whether each feature is allowed.
+class CORE_EXPORT ContentSettingsClient
+ : 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
+ public:
+ ContentSettingsClient();
+
+ void setClient(WebContentSettingsClient* client) { m_client = client; }
+
+ // Controls whether access to Web Databases is allowed.
+ bool allowDatabase(const String& name,
+ const String& displayName,
+ unsigned estimatedSize);
+
+ // Controls whether access to File System is allowed for this frame.
+ bool requestFileSystemAccessSync();
+
+ // Controls whether access to File System is allowed for this frame.
+ void requestFileSystemAccessAsync(std::unique_ptr<ContentSettingCallbacks>);
+
+ // Controls whether access to File System is allowed.
+ bool allowIndexedDB(const String& name, SecurityOrigin*);
+
+ // Controls whether scripts are allowed to execute.
+ bool allowScript(bool enabledPerSettings);
+
+ // Controls whether scripts loaded from the given URL are allowed to execute.
+ bool allowScriptFromSource(bool enabledPerSettings, const KURL&);
+
+ // Controls whether plugins are allowed.
+ bool allowPlugins(bool enabledPerSettings);
+
+ // Controls whether images are allowed.
+ bool allowImage(bool enabledPerSettings, const KURL&);
+
+ // Controls whether insecure scripts are allowed to execute for this frame.
+ bool allowRunningInsecureContent(bool enabledPerSettings,
+ SecurityOrigin*,
+ const KURL&);
+
+ // Controls whether HTML5 Web Storage is allowed for this frame.
+ enum class StorageType { kLocal, kSession };
+ bool allowStorage(StorageType);
+
+ // Controls whether access to read the clipboard is allowed for this frame.
+ bool allowReadFromClipboard(bool defaultValue);
+
+ // Controls whether access to write the clipboard is allowed for this frame.
+ bool allowWriteToClipboard(bool defaultValue);
+
+ // Controls whether to enable MutationEvents for this frame.
+ // The common use case of this method is actually to selectively disable
+ // MutationEvents, but it's been named for consistency with the rest of the
+ // interface.
+ bool allowMutationEvents(bool defaultValue);
+
+ // Controls whether autoplay is allowed for this frame.
+ bool allowAutoplay(bool defaultValue);
+
+ // Reports that passive mixed content was found at the provided URL. It may or
+ // may not be actually displayed later, what would be flagged by
+ // didDisplayInsecureContent.
+ void passiveInsecureContentFound(const KURL&);
+
+ // This callback notifies the client that the frame was about to run
+ // JavaScript but did not because allowScript returned false. We have a
+ // separate callback here because there are a number of places that need to
+ // know if JavaScript is enabled but are not necessarily preparing to execute
+ // script.
+ void didNotAllowScript();
+
+ // This callback is similar, but for plugins.
+ void didNotAllowPlugins();
+
+ DEFINE_INLINE_VIRTUAL_TRACE() {}
+
+ private:
+ WebContentSettingsClient* m_client = nullptr;
+};
+
+} // namespace blink
+
+#endif // ContentSettingsClient_h

Powered by Google App Engine
This is Rietveld 408576698