| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 m_timerStart.stop(); | 97 m_timerStart.stop(); |
| 98 | 98 |
| 99 if (!m_pattern.size()) | 99 if (!m_pattern.size()) |
| 100 return true; | 100 return true; |
| 101 | 101 |
| 102 if (m_pattern.size() == 1 && !m_pattern[0]) { | 102 if (m_pattern.size() == 1 && !m_pattern[0]) { |
| 103 m_pattern.clear(); | 103 m_pattern.clear(); |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 m_timerStart.startOneShot(0, FROM_HERE); | 107 m_timerStart.startOneShot(0, BLINK_FROM_HERE); |
| 108 m_isVibrating = true; | 108 m_isVibrating = true; |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void NavigatorVibration::cancelVibration() | 112 void NavigatorVibration::cancelVibration() |
| 113 { | 113 { |
| 114 m_pattern.clear(); | 114 m_pattern.clear(); |
| 115 if (m_isVibrating) { | 115 if (m_isVibrating) { |
| 116 Platform::current()->cancelVibration(); | 116 Platform::current()->cancelVibration(); |
| 117 m_isVibrating = false; | 117 m_isVibrating = false; |
| 118 m_timerStop.stop(); | 118 m_timerStop.stop(); |
| 119 } | 119 } |
| 120 } | 120 } |
| 121 | 121 |
| 122 void NavigatorVibration::timerStartFired(Timer<NavigatorVibration>* timer) | 122 void NavigatorVibration::timerStartFired(Timer<NavigatorVibration>* timer) |
| 123 { | 123 { |
| 124 ASSERT_UNUSED(timer, timer == &m_timerStart); | 124 ASSERT_UNUSED(timer, timer == &m_timerStart); |
| 125 | 125 |
| 126 if (m_pattern.size()) { | 126 if (m_pattern.size()) { |
| 127 m_isVibrating = true; | 127 m_isVibrating = true; |
| 128 Platform::current()->vibrate(m_pattern[0]); | 128 Platform::current()->vibrate(m_pattern[0]); |
| 129 m_timerStop.startOneShot(m_pattern[0] / 1000.0, FROM_HERE); | 129 m_timerStop.startOneShot(m_pattern[0] / 1000.0, BLINK_FROM_HERE); |
| 130 m_pattern.remove(0); | 130 m_pattern.remove(0); |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 void NavigatorVibration::timerStopFired(Timer<NavigatorVibration>* timer) | 134 void NavigatorVibration::timerStopFired(Timer<NavigatorVibration>* timer) |
| 135 { | 135 { |
| 136 ASSERT_UNUSED(timer, timer == &m_timerStop); | 136 ASSERT_UNUSED(timer, timer == &m_timerStop); |
| 137 | 137 |
| 138 if (m_pattern.isEmpty()) | 138 if (m_pattern.isEmpty()) |
| 139 m_isVibrating = false; | 139 m_isVibrating = false; |
| 140 | 140 |
| 141 if (m_pattern.size()) { | 141 if (m_pattern.size()) { |
| 142 m_timerStart.startOneShot(m_pattern[0] / 1000.0, FROM_HERE); | 142 m_timerStart.startOneShot(m_pattern[0] / 1000.0, BLINK_FROM_HERE); |
| 143 m_pattern.remove(0); | 143 m_pattern.remove(0); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void NavigatorVibration::pageVisibilityChanged() | 147 void NavigatorVibration::pageVisibilityChanged() |
| 148 { | 148 { |
| 149 if (page()->visibilityState() != PageVisibilityStateVisible) | 149 if (page()->visibilityState() != PageVisibilityStateVisible) |
| 150 cancelVibration(); | 150 cancelVibration(); |
| 151 } | 151 } |
| 152 | 152 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 return "NavigatorVibration"; | 198 return "NavigatorVibration"; |
| 199 } | 199 } |
| 200 | 200 |
| 201 DEFINE_TRACE(NavigatorVibration) | 201 DEFINE_TRACE(NavigatorVibration) |
| 202 { | 202 { |
| 203 WillBeHeapSupplement<Page>::trace(visitor); | 203 WillBeHeapSupplement<Page>::trace(visitor); |
| 204 PageLifecycleObserver::trace(visitor); | 204 PageLifecycleObserver::trace(visitor); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace blink | 207 } // namespace blink |
| OLD | NEW |