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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/chromevox/background/tabs_api_handler.js

Issue 1306773003: Make earcon ids strings instead of numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_unused_earcons
Patch Set: Fixed test Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Accesses Chrome's tabs extension API and gives 6 * @fileoverview Accesses Chrome's tabs extension API and gives
7 * feedback for events that happen in the "Chrome of Chrome". 7 * feedback for events that happen in the "Chrome of Chrome".
8 */ 8 */
9 9
10 goog.provide('cvox.TabsApiHandler'); 10 goog.provide('cvox.TabsApiHandler');
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 */ 55 */
56 onCreated: function(tab) { 56 onCreated: function(tab) {
57 if (!cvox.ChromeVox.isActive) { 57 if (!cvox.ChromeVox.isActive) {
58 return; 58 return;
59 } 59 }
60 this.tts_.speak(this.msg_('chrome_tab_created'), 60 this.tts_.speak(this.msg_('chrome_tab_created'),
61 cvox.QueueMode.FLUSH, 61 cvox.QueueMode.FLUSH,
62 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT); 62 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
63 this.braille_.write( 63 this.braille_.write(
64 cvox.NavBraille.fromText(this.msg_('chrome_tab_created'))); 64 cvox.NavBraille.fromText(this.msg_('chrome_tab_created')));
65 this.earcons_.playEarcon(cvox.AbstractEarcons.OBJECT_OPEN); 65 this.earcons_.playEarcon(cvox.Earcon.OBJECT_OPEN);
66 }, 66 },
67 67
68 /** 68 /**
69 * Handles chrome.tabs.onRemoved. 69 * Handles chrome.tabs.onRemoved.
70 * @param {Object} tab 70 * @param {Object} tab
71 */ 71 */
72 onRemoved: function(tab) { 72 onRemoved: function(tab) {
73 if (!cvox.ChromeVox.isActive) { 73 if (!cvox.ChromeVox.isActive) {
74 return; 74 return;
75 } 75 }
76 this.earcons_.playEarcon(cvox.AbstractEarcons.OBJECT_CLOSE); 76 this.earcons_.playEarcon(cvox.Earcon.OBJECT_CLOSE);
77 }, 77 },
78 78
79 /** 79 /**
80 * Handles chrome.tabs.onActivated. 80 * Handles chrome.tabs.onActivated.
81 * @param {Object} activeInfo 81 * @param {Object} activeInfo
82 */ 82 */
83 onActivated: function(activeInfo) { 83 onActivated: function(activeInfo) {
84 if (!cvox.ChromeVox.isActive) { 84 if (!cvox.ChromeVox.isActive) {
85 return; 85 return;
86 } 86 }
87 chrome.tabs.get(activeInfo.tabId, function(tab) { 87 chrome.tabs.get(activeInfo.tabId, function(tab) {
88 this.lastActiveTabLoaded_ = tab.status == 'complete'; 88 this.lastActiveTabLoaded_ = tab.status == 'complete';
89 if (tab.status == 'loading') { 89 if (tab.status == 'loading') {
90 return; 90 return;
91 } 91 }
92 var title = tab.title ? tab.title : tab.url; 92 var title = tab.title ? tab.title : tab.url;
93 this.tts_.speak(this.msg_('chrome_tab_selected', 93 this.tts_.speak(this.msg_('chrome_tab_selected',
94 [title]), 94 [title]),
95 cvox.QueueMode.FLUSH, 95 cvox.QueueMode.FLUSH,
96 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT); 96 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
97 this.braille_.write( 97 this.braille_.write(
98 cvox.NavBraille.fromText(this.msg_('chrome_tab_selected', [title]))); 98 cvox.NavBraille.fromText(this.msg_('chrome_tab_selected', [title])));
99 this.earcons_.playEarcon(cvox.AbstractEarcons.OBJECT_SELECT); 99 this.earcons_.playEarcon(cvox.Earcon.OBJECT_SELECT);
100 }.bind(this)); 100 }.bind(this));
101 }, 101 },
102 102
103 /** 103 /**
104 * Handles chrome.tabs.onUpdated. 104 * Handles chrome.tabs.onUpdated.
105 * @param {number} tabId 105 * @param {number} tabId
106 * @param {Object} selectInfo 106 * @param {Object} selectInfo
107 */ 107 */
108 onUpdated: function(tabId, selectInfo) { 108 onUpdated: function(tabId, selectInfo) {
109 if (!cvox.ChromeVox.isActive) { 109 if (!cvox.ChromeVox.isActive) {
110 return; 110 return;
111 } 111 }
112 chrome.tabs.get(tabId, function(tab) { 112 chrome.tabs.get(tabId, function(tab) {
113 if (!tab.active) { 113 if (!tab.active) {
114 return; 114 return;
115 } 115 }
116 if (tab.status == 'loading') { 116 if (tab.status == 'loading') {
117 this.lastActiveTabLoaded_ = false; 117 this.lastActiveTabLoaded_ = false;
118 this.earcons_.playEarcon(cvox.AbstractEarcons.BUSY_PROGRESS_LOOP); 118 this.earcons_.playEarcon(cvox.Earcon.BUSY_PROGRESS_LOOP);
119 } else if (!this.lastActiveTabLoaded_) { 119 } else if (!this.lastActiveTabLoaded_) {
120 this.lastActiveTabLoaded_ = true; 120 this.lastActiveTabLoaded_ = true;
121 this.earcons_.playEarcon(cvox.AbstractEarcons.TASK_SUCCESS); 121 this.earcons_.playEarcon(cvox.Earcon.TASK_SUCCESS);
122 } 122 }
123 }.bind(this)); 123 }.bind(this));
124 }, 124 },
125 125
126 /** 126 /**
127 * Handles chrome.windows.onFocusChanged. 127 * Handles chrome.windows.onFocusChanged.
128 * @param {number} windowId 128 * @param {number} windowId
129 */ 129 */
130 onFocusChanged: function(windowId) { 130 onFocusChanged: function(windowId) {
131 if (!cvox.ChromeVox.isActive) { 131 if (!cvox.ChromeVox.isActive) {
132 return; 132 return;
133 } 133 }
134 if (windowId == chrome.windows.WINDOW_ID_NONE) { 134 if (windowId == chrome.windows.WINDOW_ID_NONE) {
135 return; 135 return;
136 } 136 }
137 chrome.windows.get(windowId, function(window) { 137 chrome.windows.get(windowId, function(window) {
138 chrome.tabs.query({active: true, windowId: windowId}, function(tabs) { 138 chrome.tabs.query({active: true, windowId: windowId}, function(tabs) {
139 var msgId = window.incognito ? 'chrome_incognito_window_selected' : 139 var msgId = window.incognito ? 'chrome_incognito_window_selected' :
140 'chrome_normal_window_selected'; 140 'chrome_normal_window_selected';
141 var tab = tabs[0] || {}; 141 var tab = tabs[0] || {};
142 var title = tab.title ? tab.title : tab.url; 142 var title = tab.title ? tab.title : tab.url;
143 this.tts_.speak(this.msg_(msgId, [title]), 143 this.tts_.speak(this.msg_(msgId, [title]),
144 cvox.QueueMode.FLUSH, 144 cvox.QueueMode.FLUSH,
145 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT); 145 cvox.AbstractTts.PERSONALITY_ANNOUNCEMENT);
146 this.braille_.write( 146 this.braille_.write(
147 cvox.NavBraille.fromText(this.msg_(msgId, [title]))); 147 cvox.NavBraille.fromText(this.msg_(msgId, [title])));
148 this.earcons_.playEarcon(cvox.AbstractEarcons.OBJECT_SELECT); 148 this.earcons_.playEarcon(cvox.Earcon.OBJECT_SELECT);
149 }.bind(this)); 149 }.bind(this));
150 }.bind(this)); 150 }.bind(this));
151 } 151 }
152 }; 152 };
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/chromeos/chromevox/chromevox/injected/api_implementation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698