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

Side by Side Diff: chrome/browser/resources/chromeos/select_to_speak/select_to_speak.js

Issue 2789583004: Add a color argument to accessibilityPrivate.setFocusRing (Closed)
Patch Set: Rebase Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 var AutomationEvent = chrome.automation.AutomationEvent; 5 var AutomationEvent = chrome.automation.AutomationEvent;
6 var AutomationNode = chrome.automation.AutomationNode; 6 var AutomationNode = chrome.automation.AutomationNode;
7 var EventType = chrome.automation.EventType; 7 var EventType = chrome.automation.EventType;
8 var RoleType = chrome.automation.RoleType; 8 var RoleType = chrome.automation.RoleType;
9 9
10 /** 10 /**
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 /** @private { ?string } */ 75 /** @private { ?string } */
76 this.voiceNameFromLocale_ = null; 76 this.voiceNameFromLocale_ = null;
77 77
78 /** @private { Set<string> } */ 78 /** @private { Set<string> } */
79 this.validVoiceNames_ = new Set(); 79 this.validVoiceNames_ = new Set();
80 80
81 /** @private { number } */ 81 /** @private { number } */
82 this.speechRate_ = 1.0; 82 this.speechRate_ = 1.0;
83 83
84 /** @const { string } */
85 this.color_ = "#f73a98";
86
84 this.initPreferences_(); 87 this.initPreferences_();
85 }; 88 };
86 89
87 SelectToSpeak.prototype = { 90 SelectToSpeak.prototype = {
88 /** 91 /**
89 * Called when the mouse is pressed and the user is in a mode where 92 * Called when the mouse is pressed and the user is in a mode where
90 * select-to-speak is capturing mouse events (for example holding down 93 * select-to-speak is capturing mouse events (for example holding down
91 * Search). 94 * Search).
92 * 95 *
93 * @param {!AutomationEvent} evt 96 * @param {!AutomationEvent} evt
(...skipping 13 matching lines...) Expand all
107 * 110 *
108 * @param {!AutomationEvent} evt 111 * @param {!AutomationEvent} evt
109 */ 112 */
110 onMouseDragged_: function(evt) { 113 onMouseDragged_: function(evt) {
111 if (!this.down_) 114 if (!this.down_)
112 return; 115 return;
113 116
114 var rect = rectFromPoints( 117 var rect = rectFromPoints(
115 this.mouseStart_.x, this.mouseStart_.y, 118 this.mouseStart_.x, this.mouseStart_.y,
116 evt.mouseX, evt.mouseY); 119 evt.mouseX, evt.mouseY);
117 chrome.accessibilityPrivate.setFocusRing([rect]); 120 chrome.accessibilityPrivate.setFocusRing([rect], this.color_);
118 }, 121 },
119 122
120 /** 123 /**
121 * Called when the mouse is released and the user is in a 124 * Called when the mouse is released and the user is in a
122 * mode where select-to-speak is capturing mouse events (for example 125 * mode where select-to-speak is capturing mouse events (for example
123 * holding down Search). 126 * holding down Search).
124 * 127 *
125 * @param {!AutomationEvent} evt 128 * @param {!AutomationEvent} evt
126 */ 129 */
127 onMouseReleased_: function(evt) { 130 onMouseReleased_: function(evt) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 chrome.tts.stop(); 205 chrome.tts.stop();
203 for (var i = 0; i < nodes.length; i++) { 206 for (var i = 0; i < nodes.length; i++) {
204 var node = nodes[i]; 207 var node = nodes[i];
205 var isLast = (i == nodes.length - 1); 208 var isLast = (i == nodes.length - 1);
206 209
207 var options = { 210 var options = {
208 rate: this.rate_, 211 rate: this.rate_,
209 'enqueue': true, 212 'enqueue': true,
210 onEvent: (function(node, isLast, event) { 213 onEvent: (function(node, isLast, event) {
211 if (event.type == 'start') { 214 if (event.type == 'start') {
212 chrome.accessibilityPrivate.setFocusRing([node.location]); 215 chrome.accessibilityPrivate.setFocusRing(
216 [node.location], this.color_);
213 } else if (event.type == 'interrupted' || 217 } else if (event.type == 'interrupted' ||
214 event.type == 'cancelled') { 218 event.type == 'cancelled') {
215 chrome.accessibilityPrivate.setFocusRing([]); 219 chrome.accessibilityPrivate.setFocusRing([]);
216 } else if (event.type == 'end') { 220 } else if (event.type == 'end') {
217 if (isLast) { 221 if (isLast) {
218 chrome.accessibilityPrivate.setFocusRing([]); 222 chrome.accessibilityPrivate.setFocusRing([]);
219 } 223 }
220 } 224 }
221 }).bind(this, node, isLast) 225 }).bind(this, node, isLast)
222 }; 226 };
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 this.voiceNameFromLocale_ = voices[0].voiceName; 314 this.voiceNameFromLocale_ = voices[0].voiceName;
311 315
312 chrome.storage.sync.get(['voice'], (function(prefs) { 316 chrome.storage.sync.get(['voice'], (function(prefs) {
313 if (!prefs['voice']) { 317 if (!prefs['voice']) {
314 chrome.storage.sync.set({'voice': voices[0].voiceName}); 318 chrome.storage.sync.set({'voice': voices[0].voiceName});
315 } 319 }
316 }).bind(this)); 320 }).bind(this));
317 }).bind(this)); 321 }).bind(this));
318 } 322 }
319 }; 323 };
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/focus_ring_layer.cc ('k') | chrome/common/extensions/api/accessibility_private.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698