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

Side by Side Diff: chrome/browser/resources/access_chromevox/scripts/gmail.js

Issue 6254007: Adding ChromeVox as a component extensions (enabled only for ChromeOS, for no... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
Property Changes:
Added: svn:executable
+ *
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 goog.provide('cvox.ChromeVoxGmail');
6
7 goog.require('cvox.ChromeVox');
8 goog.require('cvox.GmailApi');
9
10
11 /**
12 * @fileoverview Script for enhancing Gmail.
13 */
14 cvox.ChromeVoxGmail = { };
15
16 /**
17 * Collection of strings to be spoken to the user.
18 * @type {Object}
19 */
20 cvox.ChromeVoxGmail.STRINGS = {
21 STARRED: 'Starred.',
22 NOT_STARRED: 'Not starred.',
23 SELECTED: 'Selected.',
24 NOT_SELECTED: 'Not selected.',
25 UNREAD: 'Unread.'
26 };
27
28 /**
29 * Listener for responding to GMail events.
30 * @type {Object}
31 */
32 cvox.ChromeVoxGmail.listener = null;
33
34 /**
35 * Initializes the Gmail script.
36 */
37 cvox.ChromeVoxGmail.init = function() {
38 cvox.ChromeVoxGmail.listener = new GmailListener();
39
40 cvox.ChromeVoxGmail.listener.onNavigatedToNewThread = function(threadObj) {
41 var threadInfo = '';
42 if (threadObj.isSelected()) {
43 threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.SELECTED + ' ';
44 }
45 if (threadObj.isStarred()) {
46 threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.STARRED + ' ';
47 }
48 if (!threadObj.isRead()) {
49 threadInfo = threadInfo + cvox.ChromeVoxGmail.STRINGS.UNREAD + ' ';
50 }
51 var threadSnippet = cvox.DomUtil.getText(threadObj.getNode());
52 cvox.ChromeVox.tts.speak(threadInfo + threadSnippet, 0, null);
53 var syncTarget = threadObj.getNode().firstChild;
54 cvox.ChromeVox.navigationManager.syncToNode(syncTarget);
55 };
56
57 cvox.ChromeVoxGmail.listener.onNavigatedToNewMessage = function(messageObj) {
58 var messageInfo = '';
59 if (messageObj.isStarred()) {
60 messageInfo = messageInfo + cvox.ChromeVoxGmail.STRINGS.STARRED + ' ';
61 }
62 var threadSnippet = cvox.DomUtil.getText(messageObj.getNode());
63 cvox.ChromeVox.tts.speak(messageInfo + threadSnippet, 0, null);
64 var syncTarget = messageObj.getNode().firstChild;
65 cvox.ChromeVox.navigationManager.syncToNode(syncTarget);
66 };
67
68 cvox.ChromeVoxGmail.listener.onNavigatedToNewSearchCompletion =
69 function(searchCompletionObj) {
70 var searchCompletionText = cvox.DomUtil.getText(
71 searchCompletionObj.getNode());
72 cvox.ChromeVox.tts.speak(searchCompletionText, 0, null);
73 };
74
75 cvox.ChromeVoxGmail.listener.onStatusChangeEvent = function(status, message) {
76 switch (status) {
77 case GmailListener.STATUS.Starred:
78 cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.STARRED, 0, null);
79 break;
80 case GmailListener.STATUS.NotStarred:
81 cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.NOT_STARRED, 0,
82 null);
83 break;
84 case GmailListener.STATUS.Selected:
85 cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.SELECTED, 0, null);
86 break;
87 case GmailListener.STATUS.NotSelected:
88 cvox.ChromeVox.tts.speak(cvox.ChromeVoxGmail.STRINGS.NOT_SELECTED, 0,
89 null);
90 break;
91 case GmailListener.STATUS.Notification:
92 cvox.ChromeVox.tts.speak(message, 0, null);
93 break;
94 }
95 };
96
97 GmailApi.setGmailEventListener(cvox.ChromeVoxGmail.listener);
98 };
99
100 window.setTimeout(cvox.ChromeVoxGmail.init, 500);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698