| 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 DCHECK(frame->document()); | 75 DCHECK(frame->document()); |
| 76 DCHECK(frame->page()); | 76 DCHECK(frame->page()); |
| 77 | 77 |
| 78 if (!frame->page()->isPageVisible()) | 78 if (!frame->page()->isPageVisible()) |
| 79 return false; | 79 return false; |
| 80 | 80 |
| 81 // TODO(lunalu): When FeaturePolicy is ready, take out the check for the | 81 // TODO(lunalu): When FeaturePolicy is ready, take out the check for the |
| 82 // runtime flag. | 82 // runtime flag. |
| 83 if (!isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) { | 83 if (!isFeatureEnabledInFrame(blink::kVibrateFeature, frame)) { |
| 84 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { | 84 if (RuntimeEnabledFeatures::featurePolicyEnabled()) { |
| 85 frame->localDOMWindow()->printErrorMessage( | 85 frame->domWindow()->printErrorMessage( |
| 86 "Navigator.vibrate() is not enabled in feature policy for this " | 86 "Navigator.vibrate() is not enabled in feature policy for this " |
| 87 "frame."); | 87 "frame."); |
| 88 } else { | 88 } else { |
| 89 frame->localDOMWindow()->printErrorMessage( | 89 frame->domWindow()->printErrorMessage( |
| 90 "A call of navigator.vibrate will be no-op inside cross-origin " | 90 "A call of navigator.vibrate will be no-op inside cross-origin " |
| 91 "iframes: https://www.chromestatus.com/feature/5682658461876224."); | 91 "iframes: https://www.chromestatus.com/feature/5682658461876224."); |
| 92 } | 92 } |
| 93 return false; | 93 return false; |
| 94 } | 94 } |
| 95 | 95 |
| 96 return NavigatorVibration::from(navigator).controller(*frame)->vibrate( | 96 return NavigatorVibration::from(navigator).controller(*frame)->vibrate( |
| 97 pattern); | 97 pattern); |
| 98 } | 98 } |
| 99 | 99 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 140 } |
| 141 } | 141 } |
| 142 | 142 |
| 143 DEFINE_TRACE(NavigatorVibration) { | 143 DEFINE_TRACE(NavigatorVibration) { |
| 144 visitor->trace(m_controller); | 144 visitor->trace(m_controller); |
| 145 Supplement<Navigator>::trace(visitor); | 145 Supplement<Navigator>::trace(visitor); |
| 146 ContextLifecycleObserver::trace(visitor); | 146 ContextLifecycleObserver::trace(visitor); |
| 147 } | 147 } |
| 148 | 148 |
| 149 } // namespace blink | 149 } // namespace blink |
| OLD | NEW |