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

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

Issue 2650733002: Revert of Update json_schema_compiler to handle the Automation extension API (Closed)
Patch Set: Created 3 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
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 * @fileoverview Handles output for Chrome's built-in find. 5 * @fileoverview Handles output for Chrome's built-in find.
6 */ 6 */
7 goog.provide('FindHandler'); 7 goog.provide('FindHandler');
8 8
9 goog.require('Output'); 9 goog.require('Output');
10 10
11 goog.scope(function() {
12 var TreeChangeObserverFilter = chrome.automation.TreeChangeObserverFilter;
13
14 /** 11 /**
15 * Responds to mode changes. 12 * Responds to mode changes.
16 * @param {ChromeVoxMode} newMode 13 * @param {ChromeVoxMode} newMode
17 * @param {?ChromeVoxMode} oldMode Can be null at startup when no range was 14 * @param {?ChromeVoxMode} oldMode Can be null at startup when no range was
18 * previously set. 15 * previously set.
19 */ 16 */
20 FindHandler.onModeChanged = function(newMode, oldMode) { 17 FindHandler.onModeChanged = function(newMode, oldMode) {
21 if (newMode == ChromeVoxMode.FORCE_NEXT) 18 if (newMode == ChromeVoxMode.FORCE_NEXT)
22 FindHandler.init_(); 19 FindHandler.init_();
23 else 20 else
24 FindHandler.uninit_(); 21 FindHandler.uninit_();
25 }; 22 };
26 23
27 /** 24 /**
28 * Initializes this module. 25 * Initializes this module.
29 * @private 26 * @private
30 */ 27 */
31 FindHandler.init_ = function() { 28 FindHandler.init_ = function() {
32 chrome.automation.addTreeChangeObserver( 29 chrome.automation.addTreeChangeObserver(
33 TreeChangeObserverFilter.NO_TREE_CHANGES, FindHandler.onTextMatch_); 30 'textMarkerChanges', FindHandler.onTextMatch_);
34 }; 31 };
35 32
36 /** 33 /**
37 * Uninitializes this module. 34 * Uninitializes this module.
38 * @private 35 * @private
39 */ 36 */
40 FindHandler.uninit_ = function() { 37 FindHandler.uninit_ = function() {
41 chrome.automation.removeTreeChangeObserver(FindHandler.onTextMatch_); 38 chrome.automation.removeTreeChangeObserver(FindHandler.onTextMatch_);
42 }; 39 };
43 40
44 /** 41 /**
45 * @param {Object} evt 42 * @param {Object} evt
46 * @private 43 * @private
47 */ 44 */
48 FindHandler.onTextMatch_ = function(evt) { 45 FindHandler.onTextMatch_ = function(evt) {
49 if (!evt.target.markerTypes.some(function(markerType) { 46 if (!evt.target.markerTypes.some(function(markerType) {
50 return markerType & 4 /* Text match */; 47 return markerType & 4 /* Text match */;
51 })) 48 }))
52 return; 49 return;
53 50
54 var range = cursors.Range.fromNode(evt.target); 51 var range = cursors.Range.fromNode(evt.target);
55 ChromeVoxState.instance.setCurrentRange(range); 52 ChromeVoxState.instance.setCurrentRange(range);
56 new Output() 53 new Output()
57 .withRichSpeechAndBraille(range, null, Output.EventType.NAVIGATE) 54 .withRichSpeechAndBraille(range, null, Output.EventType.NAVIGATE)
58 .go(); 55 .go();
59 }; 56 };
60
61 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698