OLD | NEW |
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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 DCHECK(frame->document()); | 76 DCHECK(frame->document()); |
77 DCHECK(frame->page()); | 77 DCHECK(frame->page()); |
78 | 78 |
79 if (!frame->page()->isPageVisible()) | 79 if (!frame->page()->isPageVisible()) |
80 return false; | 80 return false; |
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. Please pay attention to the user gesture code below. | 83 // runtime flag. Please pay attention to the user gesture code below. |
84 if (RuntimeEnabledFeatures::featurePolicyEnabled() && | 84 if (RuntimeEnabledFeatures::featurePolicyEnabled() && |
85 !isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) { | 85 !isFeatureEnabledInFrame(blink::WebFeaturePolicyFeature::Vibrate, |
| 86 frame)) { |
86 frame->domWindow()->printErrorMessage( | 87 frame->domWindow()->printErrorMessage( |
87 "Navigator.vibrate() is not enabled in feature policy for this " | 88 "Navigator.vibrate() is not enabled in feature policy for this " |
88 "frame."); | 89 "frame."); |
89 return false; | 90 return false; |
90 } | 91 } |
91 | 92 |
92 if (!RuntimeEnabledFeatures::featurePolicyEnabled() && | 93 if (!RuntimeEnabledFeatures::featurePolicyEnabled() && |
93 frame->isCrossOriginSubframe() && !frame->hasReceivedUserGesture()) { | 94 frame->isCrossOriginSubframe() && !frame->hasReceivedUserGesture()) { |
94 frame->domWindow()->printErrorMessage( | 95 frame->domWindow()->printErrorMessage( |
95 "Blocked call to navigator.vibrate inside a cross-origin iframe " | 96 "Blocked call to navigator.vibrate inside a cross-origin iframe " |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 DEFINE_TRACE(NavigatorVibration) { | 170 DEFINE_TRACE(NavigatorVibration) { |
170 visitor->trace(m_controller); | 171 visitor->trace(m_controller); |
171 Supplement<Navigator>::trace(visitor); | 172 Supplement<Navigator>::trace(visitor); |
172 ContextLifecycleObserver::trace(visitor); | 173 ContextLifecycleObserver::trace(visitor); |
173 } | 174 } |
174 | 175 |
175 } // namespace blink | 176 } // namespace blink |
OLD | NEW |