OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Earcons library that uses EarconEngine to play back | 6 * @fileoverview Earcons library that uses EarconEngine to play back |
7 * auditory cues. | 7 * auditory cues. |
8 */ | 8 */ |
9 | 9 |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 /** | 36 /** |
37 * @return {string} The human-readable name of the earcon set. | 37 * @return {string} The human-readable name of the earcon set. |
38 */ | 38 */ |
39 getName: function() { | 39 getName: function() { |
40 return 'ChromeVox Next earcons'; | 40 return 'ChromeVox Next earcons'; |
41 }, | 41 }, |
42 | 42 |
43 /** | 43 /** |
44 * @override | 44 * @override |
45 */ | 45 */ |
46 playEarcon: function(earcon) { | 46 playEarcon: function(earcon, opt_location) { |
47 if (!cvox.AbstractEarcons.enabled) { | 47 if (!cvox.AbstractEarcons.enabled) { |
48 return; | 48 return; |
49 } | 49 } |
50 console.log('Earcon ' + earcon); | 50 console.log('Earcon ' + earcon); |
51 | 51 if (ChromeVoxState.instance.currentRange && |
| 52 ChromeVoxState.instance.currentRange.isValid()) { |
| 53 var node = ChromeVoxState.instance.currentRange.start.node; |
| 54 var rect = opt_location || node.location; |
| 55 var container = node.root.location; |
| 56 this.engine_.setPositionForRect(rect, container); |
| 57 } |
52 switch (earcon) { | 58 switch (earcon) { |
53 case cvox.Earcon.ALERT_MODAL: | 59 case cvox.Earcon.ALERT_MODAL: |
54 case cvox.Earcon.ALERT_NONMODAL: | 60 case cvox.Earcon.ALERT_NONMODAL: |
55 this.engine_.onAlert(); | 61 this.engine_.onAlert(); |
56 break; | 62 break; |
57 case cvox.Earcon.BUTTON: | 63 case cvox.Earcon.BUTTON: |
58 this.engine_.onButton(); | 64 this.engine_.onButton(); |
59 break; | 65 break; |
60 case cvox.Earcon.CHECK_OFF: | 66 case cvox.Earcon.CHECK_OFF: |
61 this.engine_.onCheckOff(); | 67 this.engine_.onCheckOff(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 * @override | 127 * @override |
122 */ | 128 */ |
123 cancelEarcon: function(earcon) { | 129 cancelEarcon: function(earcon) { |
124 switch (earcon) { | 130 switch (earcon) { |
125 case cvox.Earcon.PAGE_START_LOADING: | 131 case cvox.Earcon.PAGE_START_LOADING: |
126 this.engine_.cancelProgress(); | 132 this.engine_.cancelProgress(); |
127 break; | 133 break; |
128 } | 134 } |
129 }, | 135 }, |
130 }; | 136 }; |
OLD | NEW |