| 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 11 matching lines...) Expand all Loading... |
| 22 * @extends {DesktopAutomationHandler} | 22 * @extends {DesktopAutomationHandler} |
| 23 */ | 23 */ |
| 24 TabsAutomationHandler = function(tabRoot) { | 24 TabsAutomationHandler = function(tabRoot) { |
| 25 DesktopAutomationHandler.call(this, tabRoot); | 25 DesktopAutomationHandler.call(this, tabRoot); |
| 26 | 26 |
| 27 if (tabRoot.role != RoleType.ROOT_WEB_AREA) | 27 if (tabRoot.role != RoleType.ROOT_WEB_AREA) |
| 28 throw new Error('Expected rootWebArea node but got ' + tabRoot.role); | 28 throw new Error('Expected rootWebArea node but got ' + tabRoot.role); |
| 29 | 29 |
| 30 // When the root is focused, simulate what happens on a load complete. | 30 // When the root is focused, simulate what happens on a load complete. |
| 31 if (tabRoot.state[StateType.FOCUSED]) { | 31 if (tabRoot.state[StateType.FOCUSED]) { |
| 32 var event = new CustomAutomationEvent( | 32 var event = |
| 33 EventType.LOAD_COMPLETE, tabRoot, 'page'); | 33 new CustomAutomationEvent(EventType.LOAD_COMPLETE, tabRoot, 'page'); |
| 34 this.onLoadComplete(event); | 34 this.onLoadComplete(event); |
| 35 } | 35 } |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 TabsAutomationHandler.prototype = { | 38 TabsAutomationHandler.prototype = { |
| 39 __proto__: DesktopAutomationHandler.prototype, | 39 __proto__: DesktopAutomationHandler.prototype, |
| 40 | 40 |
| 41 /** @override */ | 41 /** @override */ |
| 42 didHandleEvent_: function(evt) { | 42 didHandleEvent_: function(evt) { |
| 43 evt.stopPropagation(); | 43 evt.stopPropagation(); |
| 44 }, | 44 }, |
| 45 | 45 |
| 46 /** @override */ | 46 /** @override */ |
| 47 onLoadComplete: function(evt) { | 47 onLoadComplete: function(evt) { |
| 48 var focused = evt.target.find({state: {focused: true}}) || evt.target; | 48 var focused = evt.target.find({state: {focused: true}}) || evt.target; |
| 49 var event = new CustomAutomationEvent( | 49 var event = |
| 50 EventType.FOCUS, focused, evt.eventFrom); | 50 new CustomAutomationEvent(EventType.FOCUS, focused, evt.eventFrom); |
| 51 this.onFocus(event); | 51 this.onFocus(event); |
| 52 } | 52 } |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 }); // goog.scope | 55 }); // goog.scope |
| OLD | NEW |