Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 #include "core/frame/UseCounter.h" | 27 #include "core/frame/UseCounter.h" |
| 28 #include "core/page/Page.h" | 28 #include "core/page/Page.h" |
| 29 #include "modules/vibration/VibrationController.h" | 29 #include "modules/vibration/VibrationController.h" |
| 30 #include "platform/Histogram.h" | 30 #include "platform/Histogram.h" |
| 31 #include "platform/UserGestureIndicator.h" | 31 #include "platform/UserGestureIndicator.h" |
| 32 #include "public/platform/site_engagement.mojom-blink.h" | 32 #include "public/platform/site_engagement.mojom-blink.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 NavigatorVibration::NavigatorVibration(Navigator& navigator) | 36 NavigatorVibration::NavigatorVibration(Navigator& navigator) |
| 37 : ContextLifecycleObserver(navigator.frame()->document()) {} | 37 : Supplement<Navigator>(navigator), |
| 38 ContextLifecycleObserver(navigator.frame()->document()) {} | |
|
sof
2017/01/23 08:19:17
Need a frame() null check here as well?
| |
| 38 | 39 |
| 39 NavigatorVibration::~NavigatorVibration() {} | 40 NavigatorVibration::~NavigatorVibration() {} |
| 40 | 41 |
| 41 // static | 42 // static |
| 42 NavigatorVibration& NavigatorVibration::from(Navigator& navigator) { | 43 NavigatorVibration& NavigatorVibration::from(Navigator& navigator) { |
| 43 NavigatorVibration* navigatorVibration = static_cast<NavigatorVibration*>( | 44 NavigatorVibration* navigatorVibration = static_cast<NavigatorVibration*>( |
| 44 Supplement<Navigator>::from(navigator, supplementName())); | 45 Supplement<Navigator>::from(navigator, supplementName())); |
| 45 if (!navigatorVibration) { | 46 if (!navigatorVibration) { |
| 46 navigatorVibration = new NavigatorVibration(navigator); | 47 navigatorVibration = new NavigatorVibration(navigator); |
| 47 Supplement<Navigator>::provideTo(navigator, supplementName(), | 48 Supplement<Navigator>::provideTo(navigator, supplementName(), |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 |
| OLD | NEW |