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

Side by Side Diff: third_party/WebKit/Source/modules/vibration/NavigatorVibration.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 /* 1 /*
2 * Copyright (C) 2012 Samsung Electronics 2 * Copyright (C) 2012 Samsung Electronics
3 * 3 *
4 * This library is free software; you can redistribute it and/or 4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This library is distributed in the hope that it will be useful, 9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 // TODO(lunalu): When FeaturePolicy is ready, take out the check for the 82 // TODO(lunalu): When FeaturePolicy is ready, take out the check for the
83 // runtime flag. 83 // runtime flag.
84 if (!isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) { 84 if (!isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) {
85 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { 85 if (RuntimeEnabledFeatures::featurePolicyEnabled()) {
86 frame->domWindow()->printErrorMessage( 86 frame->domWindow()->printErrorMessage(
87 "Navigator.vibrate() is not enabled in feature policy for this " 87 "Navigator.vibrate() is not enabled in feature policy for this "
88 "frame."); 88 "frame.");
89 } else { 89 } else {
90 frame->domWindow()->printErrorMessage( 90 frame->domWindow()->printErrorMessage(
91 "A call of navigator.vibrate will be no-op inside cross-origin " 91 "A call of navigator.vibrate will be no-op inside a cross-origin "
92 "iframes: https://www.chromestatus.com/feature/5682658461876224."); 92 "iframe if there is no user activation on the iframe: "
93 "https://www.chromestatus.com/feature/5682658461876224.");
93 } 94 }
94 return false; 95 return false;
95 } 96 }
96 97
97 return NavigatorVibration::from(navigator).controller(*frame)->vibrate( 98 return NavigatorVibration::from(navigator).controller(*frame)->vibrate(
98 pattern); 99 pattern);
99 } 100 }
100 101
101 // static 102 // static
102 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) { 103 void NavigatorVibration::collectHistogramMetrics(const LocalFrame& frame) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 163 }
163 } 164 }
164 165
165 DEFINE_TRACE(NavigatorVibration) { 166 DEFINE_TRACE(NavigatorVibration) {
166 visitor->trace(m_controller); 167 visitor->trace(m_controller);
167 Supplement<Navigator>::trace(visitor); 168 Supplement<Navigator>::trace(visitor);
168 ContextLifecycleObserver::trace(visitor); 169 ContextLifecycleObserver::trace(visitor);
169 } 170 }
170 171
171 } // namespace blink 172 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698