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

Unified Diff: Source/modules/vibration/NavigatorVibration.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: rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/vibration/NavigatorVibration.h
diff --git a/Source/modules/vibration/NavigatorVibration.h b/Source/modules/vibration/NavigatorVibration.h
index aef7c3a512ee978d7c96a730e13207769e53c79f..86ebf08ef76eca3a29dc6e6234c3d3347057b7b5 100644
--- a/Source/modules/vibration/NavigatorVibration.h
+++ b/Source/modules/vibration/NavigatorVibration.h
@@ -20,31 +20,42 @@
#ifndef NavigatorVibration_h
#define NavigatorVibration_h
-#if ENABLE(VIBRATION)
-
-#include "core/dom/ExceptionCode.h"
+#include "core/page/Navigator.h"
+#include "core/platform/Timer.h"
+#include "wtf/PassOwnPtr.h"
#include "wtf/Vector.h"
namespace WebCore {
-class Navigator;
-class Uint32Array;
-
-class NavigatorVibration {
+class NavigatorVibration : public Supplement<Navigator> {
public:
typedef Vector<unsigned> VibrationPattern;
- static void vibrate(Navigator*, unsigned time, ExceptionCode&);
- static void vibrate(Navigator*, const VibrationPattern&, ExceptionCode&);
+ ~NavigatorVibration();
+
+ bool vibrate(const VibrationPattern&);
+ void cancelVibration();
+ // FIXME : Hook suspendVibration() and resumeVibration() into the page
+ // visibility feature, when the document.hidden attribute is changed.
+ void suspendVibration();
+ void resumeVibration();
+ void timerStartFired(Timer<NavigatorVibration>*);
+ void timerStopFired(Timer<NavigatorVibration>*);
+
+ static bool vibrate(Navigator*, unsigned time);
+ static bool vibrate(Navigator*, const VibrationPattern&);
+ static NavigatorVibration* from(Navigator*);
private:
NavigatorVibration();
- ~NavigatorVibration();
+ static const char* supplementName();
+
+ Timer<NavigatorVibration> m_timerStart;
+ Timer<NavigatorVibration> m_timerStop;
+ bool m_isVibrating;
+ VibrationPattern m_pattern;
};
} // namespace WebCore
-#endif // ENABLE(VIBRATION)
-
#endif // NavigatorVibration_h
-
« no previous file with comments | « Source/modules/modules.gypi ('k') | Source/modules/vibration/NavigatorVibration.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698