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

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ConditionalFeatures.cpp

Issue 2642263006: Allow vibrate in cross-origin iframes with user gesture. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "bindings/core/v8/ConditionalFeatures.h" 5 #include "bindings/core/v8/ConditionalFeatures.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "bindings/core/v8/V8Document.h" 8 #include "bindings/core/v8/V8Document.h"
9 #include "bindings/core/v8/V8HTMLLinkElement.h" 9 #include "bindings/core/v8/V8HTMLLinkElement.h"
10 #include "bindings/core/v8/V8Navigator.h" 10 #include "bindings/core/v8/V8Navigator.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 scriptState, v8::Local<v8::Object>(), 86 scriptState, v8::Local<v8::Object>(),
87 v8::Local<v8::Function>()); 87 v8::Local<v8::Function>());
88 } 88 }
89 89
90 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature, 90 bool isFeatureEnabledInFrame(const FeaturePolicy::Feature& feature,
91 const LocalFrame* frame) { 91 const LocalFrame* frame) {
92 // If there is no frame, or if feature policy is disabled, use defaults. 92 // If there is no frame, or if feature policy is disabled, use defaults.
93 bool enabledByDefault = 93 bool enabledByDefault =
94 (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForAll || 94 (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForAll ||
95 (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForSelf && 95 (feature.defaultPolicy == FeaturePolicy::FeatureDefault::EnableForSelf &&
96 !frame->isCrossOriginSubframe())); 96 (!frame->isCrossOriginSubframe() || frame->hasReceivedUserGesture())));
ojan 2017/01/22 23:02:54 I don't think you want this here. This is the gene
97 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame) 97 if (!RuntimeEnabledFeatures::featurePolicyEnabled() || !frame)
98 return enabledByDefault; 98 return enabledByDefault;
99 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy(); 99 FeaturePolicy* featurePolicy = frame->securityContext()->getFeaturePolicy();
100 // The policy should always be initialized before checking it to ensure we 100 // The policy should always be initialized before checking it to ensure we
101 // properly inherit the parent policy. 101 // properly inherit the parent policy.
102 DCHECK(featurePolicy); 102 DCHECK(featurePolicy);
103 103
104 // Otherwise, check policy. 104 // Otherwise, check policy.
105 return featurePolicy->isFeatureEnabled(feature); 105 return featurePolicy->isFeatureEnabled(feature);
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698