Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: Source/modules/vibration/Vibration.h

Issue 15724023: Vibration API: use runtime flag, change from client to platform. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix layout tests, minor cleanup. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 Samsung Electronics
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20 #ifndef Vibration_h
21 #define Vibration_h
22
23 #if ENABLE(VIBRATION)
24
25 #include "core/page/Page.h"
26 #include "core/platform/Timer.h"
27 #include "wtf/PassOwnPtr.h"
28
29 namespace WebCore {
30
31 class VibrationClient;
32
33 class Vibration : public Supplement<Page> {
34 public:
35 typedef Vector<unsigned> VibrationPattern;
36
37 explicit Vibration(VibrationClient*);
38 ~Vibration();
39
40 static PassOwnPtr<Vibration> create(VibrationClient*);
41
42 void vibrate(const unsigned& time);
43 void vibrate(const VibrationPattern&);
44 void cancelVibration();
45
46 // FIXME : Add suspendVibration() and resumeVibration() to the page visibili ty feature, when the document.hidden attribute is changed.
47 void suspendVibration();
48 void resumeVibration();
49 void timerStartFired(Timer<Vibration>*);
50 void timerStopFired(Timer<Vibration>*);
51
52 static const char* supplementName();
53 static Vibration* from(Page* page) { return static_cast<Vibration*>(Suppleme nt<Page>::from(page, supplementName())); }
54 static bool isActive(Page*);
55
56 private:
57 VibrationClient* m_vibrationClient;
58 Timer<Vibration> m_timerStart;
59 Timer<Vibration> m_timerStop;
60 bool m_isVibrating;
61 VibrationPattern m_pattern;
62 };
63
64 } // namespace WebCore
65
66 #endif // ENABLE(VIBRATION)
67
68 #endif // Vibration_h
69
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698