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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 if (pattern.isUnsignedLong()) | 67 if (pattern.isUnsignedLong()) |
68 sanitized.append(pattern.getAsUnsignedLong()); | 68 sanitized.append(pattern.getAsUnsignedLong()); |
69 else if (pattern.isUnsignedLongSequence()) | 69 else if (pattern.isUnsignedLongSequence()) |
70 sanitized = pattern.getAsUnsignedLongSequence(); | 70 sanitized = pattern.getAsUnsignedLongSequence(); |
71 | 71 |
72 return sanitizeVibrationPatternInternal(sanitized); | 72 return sanitizeVibrationPatternInternal(sanitized); |
73 } | 73 } |
74 | 74 |
75 VibrationController::VibrationController(Document& document) | 75 VibrationController::VibrationController(Document& document) |
76 : ContextLifecycleObserver(&document) | 76 : ContextLifecycleObserver(&document) |
77 , PageLifecycleObserver(document.page()) | 77 , PageVisibilityObserver(document.page()) |
78 , m_timerDoVibrate(this, &VibrationController::doVibrate) | 78 , m_timerDoVibrate(this, &VibrationController::doVibrate) |
79 , m_isRunning(false) | 79 , m_isRunning(false) |
80 , m_isCallingCancel(false) | 80 , m_isCallingCancel(false) |
81 , m_isCallingVibrate(false) | 81 , m_isCallingVibrate(false) |
82 { | 82 { |
83 document.frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&
m_service)); | 83 document.frame()->serviceRegistry()->connectToRemoteService(mojo::GetProxy(&
m_service)); |
84 } | 84 } |
85 | 85 |
86 VibrationController::~VibrationController() | 86 VibrationController::~VibrationController() |
87 { | 87 { |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 cancel(); | 181 cancel(); |
182 | 182 |
183 // If the document context was destroyed, never call the mojo service again. | 183 // If the document context was destroyed, never call the mojo service again. |
184 m_service.reset(); | 184 m_service.reset(); |
185 | 185 |
186 // The context is not automatically cleared, so do it manually. | 186 // The context is not automatically cleared, so do it manually. |
187 ContextLifecycleObserver::clearContext(); | 187 ContextLifecycleObserver::clearContext(); |
188 | 188 |
189 // Page outlives ExecutionContext so stop observing it to avoid having | 189 // Page outlives ExecutionContext so stop observing it to avoid having |
190 // |pageVisibilityChanged| or |contextDestroyed| called again. | 190 // |pageVisibilityChanged| or |contextDestroyed| called again. |
191 PageLifecycleObserver::clearContext(); | 191 PageVisibilityObserver::clearContext(); |
192 } | 192 } |
193 | 193 |
194 void VibrationController::pageVisibilityChanged() | 194 void VibrationController::pageVisibilityChanged() |
195 { | 195 { |
196 if (!page()->isPageVisible()) | 196 if (!page()->isPageVisible()) |
197 cancel(); | 197 cancel(); |
198 } | 198 } |
199 | 199 |
200 DEFINE_TRACE(VibrationController) | 200 DEFINE_TRACE(VibrationController) |
201 { | 201 { |
202 ContextLifecycleObserver::trace(visitor); | 202 ContextLifecycleObserver::trace(visitor); |
203 PageLifecycleObserver::trace(visitor); | 203 PageVisibilityObserver::trace(visitor); |
204 } | 204 } |
205 | 205 |
206 } // namespace blink | 206 } // namespace blink |
OLD | NEW |