| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * Class to manage SwitchAccess and interact with other controllers. | 6 * Class to manage SwitchAccess and interact with other controllers. |
| 7 * | 7 * |
| 8 * @constructor | 8 * @constructor |
| 9 * @implements {SwitchAccessInterface} | 9 * @implements {SwitchAccessInterface} |
| 10 */ | 10 */ |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * Perform the default action on the currently selected node. | 102 * Perform the default action on the currently selected node. |
| 103 * | 103 * |
| 104 * @override | 104 * @override |
| 105 */ | 105 */ |
| 106 doDefault: function() { | 106 doDefault: function() { |
| 107 if (!this.node_) | 107 if (!this.node_) |
| 108 return; | 108 return; |
| 109 | 109 |
| 110 let state = this.node_.state; | |
| 111 if (state && state.focusable) | |
| 112 console.log('Node was focusable, doing default on it') | |
| 113 else if (state) | |
| 114 console.log('Node was not focusable, but still doing default'); | |
| 115 else | |
| 116 console.log('Node has no state, still doing default'); | |
| 117 console.log('\n'); | |
| 118 this.node_.doDefault(); | 110 this.node_.doDefault(); |
| 119 }, | 111 }, |
| 120 | 112 |
| 121 /** | 113 /** |
| 122 * Open the options page in a new tab. | 114 * Open the options page in a new tab. |
| 123 * | 115 * |
| 124 * @override | 116 * @override |
| 125 */ | 117 */ |
| 126 showOptionsPage: function() { | 118 showOptionsPage: function() { |
| 127 let optionsPage = {url: 'options.html'}; | 119 let optionsPage = {url: 'options.html'}; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 /** | 155 /** |
| 164 * Print out details about a node. | 156 * Print out details about a node. |
| 165 * | 157 * |
| 166 * @param {chrome.automation.AutomationNode} node | 158 * @param {chrome.automation.AutomationNode} node |
| 167 * @private | 159 * @private |
| 168 */ | 160 */ |
| 169 printNode_: function(node) { | 161 printNode_: function(node) { |
| 170 if (node) { | 162 if (node) { |
| 171 console.log('Name = ' + node.name); | 163 console.log('Name = ' + node.name); |
| 172 console.log('Role = ' + node.role); | 164 console.log('Role = ' + node.role); |
| 165 console.log('Root role = ' + node.root.role); |
| 173 if (!node.parent) | 166 if (!node.parent) |
| 174 console.log('At index ' + node.indexInParent + ', has no parent'); | 167 console.log('At index ' + node.indexInParent + ', has no parent'); |
| 175 else { | 168 else { |
| 176 let numSiblings = node.parent.children.length; | 169 let numSiblings = node.parent.children.length; |
| 177 console.log( | 170 console.log( |
| 178 'At index ' + node.indexInParent + ', there are ' | 171 'At index ' + node.indexInParent + ', there are ' |
| 179 + numSiblings + ' siblings'); | 172 + numSiblings + ' siblings'); |
| 180 } | 173 } |
| 181 console.log('Has ' + node.children.length + ' children'); | 174 console.log('Has ' + node.children.length + ' children'); |
| 182 } else { | 175 } else { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 */ | 228 */ |
| 236 debugMoveToParent: function() { | 229 debugMoveToParent: function() { |
| 237 let parent = this.treeWalker_.debugMoveToParent(this.node_); | 230 let parent = this.treeWalker_.debugMoveToParent(this.node_); |
| 238 if (parent) { | 231 if (parent) { |
| 239 this.node_ = parent; | 232 this.node_ = parent; |
| 240 this.printNode_(this.node_); | 233 this.printNode_(this.node_); |
| 241 chrome.accessibilityPrivate.setFocusRing([this.node_.location]); | 234 chrome.accessibilityPrivate.setFocusRing([this.node_.location]); |
| 242 } | 235 } |
| 243 } | 236 } |
| 244 }; | 237 }; |
| OLD | NEW |