OLD | NEW |
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 /** | 5 /** |
6 * @fileoverview Objects related to incremental search. | 6 * @fileoverview Objects related to incremental search. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('ISearch'); | 9 goog.provide('ISearch'); |
10 goog.provide('ISearchHandler'); | 10 goog.provide('ISearchHandler'); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 window.setTimeout(move.bind(this, this.node_), 0); | 105 window.setTimeout(move.bind(this, this.node_), 0); |
106 } | 106 } |
107 }; | 107 }; |
108 | 108 |
109 /** | 109 /** |
110 * @param {Element} input | 110 * @param {Element} input |
111 * @constructor | 111 * @constructor |
112 * @implements {ISearchHandler} | 112 * @implements {ISearchHandler} |
113 */ | 113 */ |
114 ISearchUI = function(input) { | 114 ISearchUI = function(input) { |
115 /** @type {ChromeVoxState} */ | 115 /** @type {ChromeVoxState} @private */ |
116 this.background_ = | 116 this.background_ = |
117 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; | 117 chrome.extension.getBackgroundPage()['ChromeVoxState']['instance']; |
118 this.iSearch_ = new ISearch(this.background_.currentRange.start.node); | 118 this.iSearch_ = new ISearch(this.background_.currentRange.start.node); |
119 this.input_ = input; | 119 this.input_ = input; |
120 this.dir_ = Dir.FORWARD; | 120 this.dir_ = Dir.FORWARD; |
121 this.iSearch_.handler = this; | 121 this.iSearch_.handler = this; |
122 | 122 |
123 this.onKeyDown = this.onKeyDown.bind(this); | 123 this.onKeyDown = this.onKeyDown.bind(this); |
124 this.onTextInput = this.onTextInput.bind(this); | 124 this.onTextInput = this.onTextInput.bind(this); |
125 | 125 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 */ | 197 */ |
198 onSearchResultChanged: function(node) { | 198 onSearchResultChanged: function(node) { |
199 this.output_(node); | 199 this.output_(node); |
200 }, | 200 }, |
201 | 201 |
202 /** | 202 /** |
203 * @param {!AutomationNode} node | 203 * @param {!AutomationNode} node |
204 * @private | 204 * @private |
205 */ | 205 */ |
206 output_: function(node) { | 206 output_: function(node) { |
207 Output.flushNextSpeechUtterance(); | 207 Output.forceModeForNextSpeechUtterance(cvox.QueueMode.FLUSH); |
208 var o = new Output().withRichSpeechAndBraille( | 208 var o = new Output().withRichSpeechAndBraille( |
209 cursors.Range.fromNode(node), null, Output.EventType.NAVIGATE).go(); | 209 cursors.Range.fromNode(node), null, Output.EventType.NAVIGATE).go(); |
210 | 210 |
211 this.background_.setCurrentRange(cursors.Range.fromNode(node)); | 211 this.background_.setCurrentRange(cursors.Range.fromNode(node)); |
212 }, | 212 }, |
213 | 213 |
214 /** Unregisters event handlers. */ | 214 /** Unregisters event handlers. */ |
215 destroy: function() { | 215 destroy: function() { |
216 this.iSearch_.handler_ = null; | 216 this.iSearch_.handler_ = null; |
217 this.iSearch_ = null; | 217 this.iSearch_ = null; |
218 var input = this.input_; | 218 var input = this.input_; |
219 this.input_ = null; | 219 this.input_ = null; |
220 input.removeEventListener('keydown', this.onKeyDown, true); | 220 input.removeEventListener('keydown', this.onKeyDown, true); |
221 input.removeEventListener('textInput', this.onTextInput, true); | 221 input.removeEventListener('textInput', this.onTextInput, true); |
222 } | 222 } |
223 }; | 223 }; |
224 | 224 |
225 }); // goog.scope | 225 }); // goog.scope |
OLD | NEW |