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.
6 * @fileoverview Initializes the injected content script.
10 goog.provide('cvox.InitGlobals');
12 goog.require('cvox.ApiImplementation');
13 goog.require('cvox.ChromeVox');
14 goog.require('cvox.ChromeVoxEventWatcher');
15 goog.require('cvox.CompositeTts');
16 goog.require('cvox.ConsoleTts');
17 goog.require('cvox.HostFactory');
18 goog.require('cvox.NavigationManager');
19 goog.require('cvox.Serializer');
20 goog.require('cvox.SpokenMessages');
27 cvox.InitGlobals = function() { };
31 * Initializes cvox.ChromeVox.
33 cvox.InitGlobals.initGlobals = function() {
34 if (!cvox.ChromeVox.host) {
35 cvox.ChromeVox.host = cvox.HostFactory.getHost();
38 cvox.ChromeVox.tts = new cvox.CompositeTts()
39 .add(cvox.HostFactory.getTts())
40 .add(cvox.History.getInstance())
41 .add(cvox.ConsoleTts.getInstance());
43 if (!cvox.ChromeVox.braille) {
44 cvox.ChromeVox.braille = cvox.HostFactory.getBraille();
46 cvox.ChromeVox.mathJax = cvox.HostFactory.getMathJax();
48 cvox.ChromeVox.earcons = cvox.HostFactory.getEarcons();
49 cvox.ChromeVox.msgs = new cvox.Msgs();
50 cvox.ChromeVox.isActive = true;
51 cvox.ChromeVox.navigationManager = new cvox.NavigationManager();
52 cvox.ChromeVox.navigationManager.updateIndicator();
53 cvox.ChromeVox.syncToNode = cvox.ApiImplementation.syncToNode;
54 cvox.ChromeVox.speakNode = cvox.ApiImplementation.speakNode;
56 cvox.ChromeVox.serializer = new cvox.Serializer();
58 // Do platform specific initialization here.
59 cvox.ChromeVox.host.init();
61 // Start the event watchers
62 cvox.ChromeVoxEventWatcher.init(window);
64 // Provide a way for modules that can't depend on cvox.ChromeVoxUserCommands
65 // to execute commands.
66 cvox.ChromeVox.executeUserCommand = function(commandName) {
67 cvox.ChromeVoxUserCommands.commands[commandName]();
70 cvox.ChromeVox.host.onPageLoad();