| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 Abstract interface to methods that differ depending on the | 6 * @fileoverview Abstract interface to methods that differ depending on the |
| 7 * host platform. | 7 * host platform. |
| 8 * | 8 * |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 var active = state == cvox.AbstractHost.State.ACTIVE; | 136 var active = state == cvox.AbstractHost.State.ACTIVE; |
| 137 if (active == cvox.ChromeVox.isActive) { | 137 if (active == cvox.ChromeVox.isActive) { |
| 138 return; | 138 return; |
| 139 } | 139 } |
| 140 cvox.ChromeVoxEventWatcher.cleanup(window); | 140 cvox.ChromeVoxEventWatcher.cleanup(window); |
| 141 switch (state) { | 141 switch (state) { |
| 142 case cvox.AbstractHost.State.ACTIVE: | 142 case cvox.AbstractHost.State.ACTIVE: |
| 143 cvox.ChromeVox.isActive = true; | 143 cvox.ChromeVox.isActive = true; |
| 144 cvox.ChromeVox.navigationManager.showOrHideIndicator(true); | 144 cvox.ChromeVox.navigationManager.showOrHideIndicator(true); |
| 145 cvox.ChromeVoxEventWatcher.init(window); | 145 cvox.ChromeVoxEventWatcher.init(window); |
| 146 if (document.activeElement) { | 146 if (!document.activeElement) { |
| 147 var speakNodeAlso = cvox.ChromeVox.documentHasFocus(); | |
| 148 cvox.ApiImplementation.syncToNode( | |
| 149 document.activeElement, speakNodeAlso); | |
| 150 } else { | |
| 151 cvox.ChromeVox.navigationManager.updateIndicator(); | 147 cvox.ChromeVox.navigationManager.updateIndicator(); |
| 152 } | 148 } |
| 153 break; | 149 break; |
| 154 case cvox.AbstractHost.State.INACTIVE: | 150 case cvox.AbstractHost.State.INACTIVE: |
| 155 cvox.ChromeVox.isActive = false; | 151 cvox.ChromeVox.isActive = false; |
| 156 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); | 152 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); |
| 157 // If ChromeVox is inactive, the event watcher will only listen for key | 153 // If ChromeVox is inactive, the event watcher will only listen for key |
| 158 // down events. | 154 // down events. |
| 159 cvox.ChromeVoxEventWatcher.init(window); | 155 cvox.ChromeVoxEventWatcher.init(window); |
| 160 break; | 156 break; |
| 161 case cvox.AbstractHost.State.KILLED: | 157 case cvox.AbstractHost.State.KILLED: |
| 162 cvox.ChromeVox.isActive = false; | 158 cvox.ChromeVox.isActive = false; |
| 163 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); | 159 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); |
| 164 break; | 160 break; |
| 165 } | 161 } |
| 166 }; | 162 }; |
| OLD | NEW |