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

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

Issue 2238613002: Support output for Chrome's native find in ChromeVox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@text_markers
Patch Set: Don't forget to bit shift in SendTreeChanges (checking against cached overall tree filter). Created 4 years, 4 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
(Empty)
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
3 // found in the LICENSE file.
4 /**
5 * @fileoverview Handles output for Chrome's built-in find.
6 */
7 goog.provide('FindHandler');
8
9 goog.require('Output');
10
11 /**
12 * Responds to mode changes.
13 * @param {ChromeVoxMode} newMode
14 * @param {?ChromeVoxMode} oldMode Can be null at startup when no range was
15 * previously set.
16 */
17 FindHandler.onModeChanged = function(newMode, oldMode) {
18 if (newMode == ChromeVoxMode.FORCE_NEXT)
19 FindHandler.init_();
20 else
21 FindHandler.uninit_();
22 };
23
24 /**
25 * Initializes this module.
26 * @private
27 */
28 FindHandler.init_ = function() {
29 chrome.automation.addTreeChangeObserver(
30 'textMarkerChanges', FindHandler.onTextMatch_);
31 };
32
33 /**
34 * Uninitializes this module.
35 * @private
36 */
37 FindHandler.uninit_ = function() {
38 chrome.automation.removeTreeChangeObserver(FindHandler.onTextMatch_);
39 };
40
41 /**
42 * @param {Object} evt
43 * @private
44 */
45 FindHandler.onTextMatch_ = function(evt) {
46 if (!evt.target.markerTypes.some(function(markerType) {
47 return markerType & 4 /* Text match */;
48 }))
49 return;
50
51 var range = cursors.Range.fromNode(evt.target);
52 ChromeVoxState.instance.setCurrentRange(range);
53 new Output()
54 .withRichSpeechAndBraille(range, null, Output.EventType.NAVIGATE)
55 .go();
56 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698