Bug 810359 - Introduce haptic feedback. r=davidb

This commit is contained in:
Eitan Isaacson 2012-11-12 15:46:09 -08:00
parent a47163f9eb
commit 9483d8e0fd
3 changed files with 27 additions and 3 deletions

View File

@ -301,6 +301,10 @@ var Output = {
}
},
Haptic: function Haptic(aDetails, aBrowser) {
this.chromeWin.navigator.vibrate(aDetails.pattern);
},
_adjustBounds: function(aJsonBounds, aBrowser) {
let bounds = new Rect(aJsonBounds.left, aJsonBounds.top,
aJsonBounds.right - aJsonBounds.left,

View File

@ -26,6 +26,7 @@ this.EventManager = {
if (Utils.MozBuildApp == 'b2g') {
this.presenters.push(new SpeechPresenter());
this.presenters.push(new HapticPresenter());
} else if (Utils.MozBuildApp == 'mobile/android') {
this.presenters.push(new AndroidPresenter());
}

View File

@ -17,6 +17,7 @@ this.EXPORTED_SYMBOLS = ['VisualPresenter',
'AndroidPresenter',
'DummyAndroidPresenter',
'SpeechPresenter',
'HapticPresenter',
'PresenterContext'];
/**
@ -111,7 +112,7 @@ Presenter.prototype = {
* Visual presenter. Draws a box around the virtual cursor's position.
*/
this.VisualPresenter = function VisualPresenter() {}
this.VisualPresenter = function VisualPresenter() {};
VisualPresenter.prototype = {
__proto__: Presenter.prototype,
@ -179,7 +180,7 @@ VisualPresenter.prototype = {
* Android presenter. Fires Android a11y events.
*/
this.AndroidPresenter = function AndroidPresenter() {}
this.AndroidPresenter = function AndroidPresenter() {};
AndroidPresenter.prototype = {
__proto__: Presenter.prototype,
@ -332,7 +333,7 @@ AndroidPresenter.prototype = {
* A speech presenter for direct TTS output
*/
this.SpeechPresenter = function SpeechPresenter() {}
this.SpeechPresenter = function SpeechPresenter() {};
SpeechPresenter.prototype = {
__proto__: Presenter.prototype,
@ -372,6 +373,24 @@ SpeechPresenter.prototype = {
}
};
/**
* A haptic presenter
*/
this.HapticPresenter = function HapticPresenter() {};
HapticPresenter.prototype = {
__proto__: Presenter.prototype,
type: 'Haptic',
PIVOT_CHANGE_PATTHERN: [20],
pivotChanged: function HapticPresenter_pivotChanged(aContext, aReason) {
return { type: this.type, details: { pattern: this.PIVOT_CHANGE_PATTHERN } };
}
};
/**
* PresenterContext: An object that generates and caches context information
* for a given accessible and its relationship with another accessible.