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

Unified Diff: content/child/blink_platform_impl.cc

Issue 2651883008: Make content::FeaturePolicy implement WebFeaturePolicy, and use it in blink code (Closed)
Patch Set: Rebasing intensifies... Created 3 years, 10 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: content/child/blink_platform_impl.cc
diff --git a/content/child/blink_platform_impl.cc b/content/child/blink_platform_impl.cc
index b2b964a690c121637c09c5e9385c0e7f1378518e..db93f9b79f09853efe6162f49ac52ffa6a6a2883 100644
--- a/content/child/blink_platform_impl.cc
+++ b/content/child/blink_platform_impl.cc
@@ -39,6 +39,7 @@
#include "content/app/strings/grit/content_strings.h"
#include "content/child/child_thread_impl.h"
#include "content/child/content_child_helpers.h"
+#include "content/child/feature_policy/feature_policy_platform.h"
#include "content/child/notifications/notification_dispatcher.h"
#include "content/child/notifications/notification_manager.h"
#include "content/child/push_messaging/push_provider.h"
@@ -850,4 +851,28 @@ int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) {
ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8()));
}
+blink::WebFeaturePolicy* BlinkPlatformImpl::createFeaturePolicy(
+ const blink::WebFeaturePolicy* parent_policy,
+ const blink::WebParsedFeaturePolicyHeader& container_policy,
+ const blink::WebParsedFeaturePolicyHeader& policy_header,
+ const blink::WebSecurityOrigin& origin) {
+ std::unique_ptr<FeaturePolicy> policy = FeaturePolicy::CreateFromParentPolicy(
+ static_cast<const FeaturePolicy*>(parent_policy),
+ FeaturePolicyHeaderFromWeb(container_policy), url::Origin(origin));
+ policy->SetHeaderPolicy(FeaturePolicyHeaderFromWeb(policy_header));
+ return policy.release();
+}
+
+bool BlinkPlatformImpl::isFeatureEnabledByPolicy(
+ const blink::WebFeaturePolicy* policy,
+ blink::WebFeaturePolicyFeature feature) {
+ return static_cast<const FeaturePolicy*>(policy)->IsFeatureEnabled(feature);
haraken 2017/02/28 06:41:43 Hmm, it looks a bit weird that we're redirecting a
iclelland 2017/02/28 21:02:39 I can move isFeatureEnabledByPolicy and updateFeat
+}
+
+void BlinkPlatformImpl::updateFeaturePolicyOrigin(
+ blink::WebFeaturePolicy* policy,
+ const blink::WebSecurityOrigin& origin) {
+ static_cast<FeaturePolicy*>(policy)->SetOrigin(url::Origin(origin));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698