OLD | NEW |
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 |
(...skipping 10 matching lines...) Expand all Loading... |
21 */ | 21 */ |
22 TabsAutomationHandler = function(tabRoot) { | 22 TabsAutomationHandler = function(tabRoot) { |
23 DesktopAutomationHandler.call(this, tabRoot); | 23 DesktopAutomationHandler.call(this, tabRoot); |
24 | 24 |
25 if (tabRoot.role != RoleType.rootWebArea) | 25 if (tabRoot.role != RoleType.rootWebArea) |
26 throw new Error('Expected rootWebArea node but got ' + tabRoot.role); | 26 throw new Error('Expected rootWebArea node but got ' + tabRoot.role); |
27 | 27 |
28 // 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. |
29 if (tabRoot.state.focused) { | 29 if (tabRoot.state.focused) { |
30 this.onLoadComplete( | 30 this.onLoadComplete( |
31 new chrome.automation.AutomationEvent(EventType.loadComplete, tabRoot, | 31 new ChromeVoxAutomationEvent(EventType.loadComplete, tabRoot, |
32 'page')); | 32 'page')); |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 TabsAutomationHandler.prototype = { | 36 TabsAutomationHandler.prototype = { |
37 __proto__: DesktopAutomationHandler.prototype, | 37 __proto__: DesktopAutomationHandler.prototype, |
38 | 38 |
39 /** @override */ | 39 /** @override */ |
40 didHandleEvent_: function(evt) { | 40 didHandleEvent_: function(evt) { |
41 evt.stopPropagation(); | 41 evt.stopPropagation(); |
42 }, | 42 }, |
43 | 43 |
44 /** @override */ | 44 /** @override */ |
45 onLoadComplete: function(evt) { | 45 onLoadComplete: function(evt) { |
46 var focused = evt.target.find({state: {focused: true}}) || evt.target; | 46 var focused = evt.target.find({state: {focused: true}}) || evt.target; |
47 this.onFocus(new chrome.automation.AutomationEvent( | 47 this.onFocus(new ChromeVoxAutomationEvent( |
48 EventType.focus, focused, evt.eventFrom)); | 48 EventType.focus, focused, evt.eventFrom)); |
49 } | 49 } |
50 }; | 50 }; |
51 | 51 |
52 }); // goog.scope | 52 }); // goog.scope |
OLD | NEW |