Index: third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp |
diff --git a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp |
index ce72bc0774435ef851a5994d41f56c561ff41be3..ff7ba505213160a9a900cd9a103bb9891c4a74ed 100644 |
--- a/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp |
+++ b/third_party/WebKit/Source/modules/vibration/NavigatorVibration.cpp |
@@ -19,6 +19,7 @@ |
#include "modules/vibration/NavigatorVibration.h" |
+#include "bindings/core/v8/ConditionalFeatures.h" |
#include "core/dom/Document.h" |
#include "core/frame/LocalDOMWindow.h" |
#include "core/frame/LocalFrame.h" |
@@ -77,9 +78,16 @@ bool NavigatorVibration::vibrate(Navigator& navigator, |
if (!frame->page()->isPageVisible()) |
return false; |
- if (frame->isCrossOriginSubframe()) { |
- // TODO(binlu): Once FeaturePolicy is ready, exploring using it to |
- // remove the API instead of having it return false. |
+ // TODO(lunalu): When FeaturePolicy is ready, take out the check for the |
+ // runtime flag. |
+ if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
+ if (!isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) { |
+ frame->localDOMWindow()->printErrorMessage( |
+ "Navigator.vibrate() is not enabled in feature policy for this " |
+ "frame."); |
+ return false; |
+ } |
+ } else if (frame->isCrossOriginSubframe()) { |
iclelland
2016/11/16 15:25:12
I think we could actually move this check into bli
|
frame->localDOMWindow()->printErrorMessage( |
"A call of navigator.vibrate will be no-op inside cross-origin " |
"iframes: https://www.chromestatus.com/feature/5682658461876224."); |