host_factory.js revision 1320f92c476a1ad9d19dba2a48c72b75566198e9
1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5 6/** 7 * @fileoverview A host factory. This factory allows us to decouple the 8 * cvox.Host|Tts|... creatation from the main ChromeVox code. 9 */ 10 11goog.provide('cvox.HostFactory'); 12 13goog.require('cvox.AbstractBraille'); 14goog.require('cvox.AbstractEarcons'); 15goog.require('cvox.AbstractHost'); 16goog.require('cvox.AbstractMathJax'); 17goog.require('cvox.AbstractTts'); 18 19 20/** 21 * @constructor 22 */ 23cvox.HostFactory = function() {}; 24 25/** 26 * Returns the host. 27 * @return {cvox.AbstractHost} 28 */ 29cvox.HostFactory.getHost = function() { 30 return new cvox.HostFactory.hostConstructor; 31}; 32 33/** 34 * Returns the TTS interface. 35 * @return {cvox.TtsInterface} The TTS engine. 36 */ 37cvox.HostFactory.getTts = function() { 38 return new cvox.HostFactory.ttsConstructor; 39}; 40 41/** 42 * Returns the Braille interface. 43 * @return {cvox.BrailleInterface} The Braille interface. 44 */ 45cvox.HostFactory.getBraille = function() { 46 return new cvox.HostFactory.brailleConstructor; 47}; 48 49/** 50 * Returns the earcons interface. 51 * @return {cvox.AbstractEarcons} 52 */ 53cvox.HostFactory.getEarcons = function() { 54 return new cvox.HostFactory.earconsConstructor; 55}; 56 57/** 58 * Returns the MathJax interface. 59 * @return {cvox.MathJaxInterface} The MathJax interface. 60 */ 61cvox.HostFactory.getMathJax = function() { 62 return new cvox.HostFactory.mathJaxConstructor; 63}; 64 65/** 66 * @type {function (new:cvox.AbstractHost)} 67 */ 68cvox.HostFactory.hostConstructor; 69 70/** 71 * @type {function (new:cvox.TtsInterface)} 72 */ 73cvox.HostFactory.ttsConstructor; 74 75/** 76 * @type {function (new:cvox.BrailleInterface)} 77 */ 78cvox.HostFactory.brailleConstructor; 79 80/** 81 * @type {function (new:cvox.AbstractEarcons)} 82 */ 83cvox.HostFactory.earconsConstructor; 84 85 86/** 87 * @type {function (new:cvox.AbstractMathJax)} 88 */ 89cvox.HostFactory.mathJaxConstructor; 90