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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/tabs_automation_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 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 Handles automation from a tabs automation node. 6 * @fileoverview Handles automation from a tabs automation node.
7 */ 7 */
8 8
9 goog.provide('TabsAutomationHandler'); 9 goog.provide('TabsAutomationHandler');
10 10
11 goog.require('CustomAutomationEvent');
12 goog.require('DesktopAutomationHandler'); 11 goog.require('DesktopAutomationHandler');
13 12
14 goog.scope(function() { 13 goog.scope(function() {
15 var EventType = chrome.automation.EventType; 14 var EventType = chrome.automation.EventType;
16 var RoleType = chrome.automation.RoleType; 15 var RoleType = chrome.automation.RoleType;
17 var StateType = chrome.automation.StateType;
18 16
19 /** 17 /**
20 * @param {!chrome.automation.AutomationNode} tabRoot 18 * @param {!chrome.automation.AutomationNode} tabRoot
21 * @constructor 19 * @constructor
22 * @extends {DesktopAutomationHandler} 20 * @extends {DesktopAutomationHandler}
23 */ 21 */
24 TabsAutomationHandler = function(tabRoot) { 22 TabsAutomationHandler = function(tabRoot) {
25 DesktopAutomationHandler.call(this, tabRoot); 23 DesktopAutomationHandler.call(this, tabRoot);
26 24
27 if (tabRoot.role != RoleType.ROOT_WEB_AREA) 25 if (tabRoot.role != RoleType.rootWebArea)
28 throw new Error('Expected rootWebArea node but got ' + tabRoot.role); 26 throw new Error('Expected rootWebArea node but got ' + tabRoot.role);
29 27
30 // When the root is focused, simulate what happens on a load complete. 28 // When the root is focused, simulate what happens on a load complete.
31 if (tabRoot.state[StateType.FOCUSED]) { 29 if (tabRoot.state.focused) {
32 var event = new CustomAutomationEvent( 30 this.onLoadComplete(
33 EventType.LOAD_COMPLETE, tabRoot, 'page'); 31 new chrome.automation.AutomationEvent(EventType.loadComplete, tabRoot,
34 this.onLoadComplete(event); 32 'page'));
35 } 33 }
36 }; 34 };
37 35
38 TabsAutomationHandler.prototype = { 36 TabsAutomationHandler.prototype = {
39 __proto__: DesktopAutomationHandler.prototype, 37 __proto__: DesktopAutomationHandler.prototype,
40 38
41 /** @override */ 39 /** @override */
42 didHandleEvent_: function(evt) { 40 didHandleEvent_: function(evt) {
43 evt.stopPropagation(); 41 evt.stopPropagation();
44 }, 42 },
45 43
46 /** @override */ 44 /** @override */
47 onLoadComplete: function(evt) { 45 onLoadComplete: function(evt) {
48 var focused = evt.target.find({state: {focused: true}}) || evt.target; 46 var focused = evt.target.find({state: {focused: true}}) || evt.target;
49 var event = new CustomAutomationEvent( 47 this.onFocus(new chrome.automation.AutomationEvent(
50 EventType.FOCUS, focused, evt.eventFrom); 48 EventType.focus, focused, evt.eventFrom));
51 this.onFocus(event);
52 } 49 }
53 }; 50 };
54 51
55 }); // goog.scope 52 }); // goog.scope
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698