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

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: 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 FindHandler.uninit_();
30 chrome.automation.addTreeChangeObserver(
31 'textMarkerChanges', FindHandler.onTextMatch_);
32 };
33
34 /**
35 * Uninitializes this module.
36 * @private
37 */
38 FindHandler.uninit_ = function() {
39 chrome.automation.removeTreeChangeObserver(FindHandler.onTextMatch_);
40 };
41
42 /**
43 * @param {Object} evt
44 * @private
45 */
46 FindHandler.onTextMatch_ = function(evt) {
47 if (!evt.target.markerTypes.some(function(markerType) {
48 return markerType == 3 /* Text match */;
49 }))
50 return;
51
52 var range = cursors.Range.fromNode(evt.target);
dmazzoni 2016/08/10 22:12:10 Does this work if there are multiple matches?
53 ChromeVoxState.instance.setCurrentRange(range);
54 new Output()
55 .withRichSpeechAndBraille(range, null, Output.EventType.NAVIGATE)
56 .go();
57 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698