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 if (active == cvox.ChromeVox.isActive) { | 136 if (active == cvox.ChromeVox.isActive) { |
137 return; | 137 return; |
138 } | 138 } |
139 cvox.ChromeVoxEventWatcher.cleanup(window); | 139 cvox.ChromeVoxEventWatcher.cleanup(window); |
140 switch (state) { | 140 switch (state) { |
141 case cvox.AbstractHost.State.ACTIVE: | 141 case cvox.AbstractHost.State.ACTIVE: |
142 cvox.ChromeVox.isActive = true; | 142 cvox.ChromeVox.isActive = true; |
143 cvox.ChromeVox.navigationManager.showOrHideIndicator(true); | 143 cvox.ChromeVox.navigationManager.showOrHideIndicator(true); |
144 cvox.ChromeVoxEventWatcher.init(window); | 144 cvox.ChromeVoxEventWatcher.init(window); |
145 if (document.activeElement) { | 145 if (document.activeElement) { |
146 var speakNodeAlso = document.hasFocus() && !document.webkitHidden; | 146 var speakNodeAlso = cvox.ChromeVox.documentHasFocus(); |
147 cvox.ApiImplementation.syncToNode( | 147 cvox.ApiImplementation.syncToNode( |
148 document.activeElement, speakNodeAlso); | 148 document.activeElement, speakNodeAlso); |
149 } else { | 149 } else { |
150 cvox.ChromeVox.navigationManager.updateIndicator(); | 150 cvox.ChromeVox.navigationManager.updateIndicator(); |
151 } | 151 } |
152 break; | 152 break; |
153 case cvox.AbstractHost.State.INACTIVE: | 153 case cvox.AbstractHost.State.INACTIVE: |
154 cvox.ChromeVox.isActive = false; | 154 cvox.ChromeVox.isActive = false; |
155 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); | 155 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); |
156 // If ChromeVox is inactive, the event watcher will only listen for key | 156 // If ChromeVox is inactive, the event watcher will only listen for key |
157 // down events. | 157 // down events. |
158 cvox.ChromeVoxEventWatcher.init(window); | 158 cvox.ChromeVoxEventWatcher.init(window); |
159 break; | 159 break; |
160 case cvox.AbstractHost.State.KILLED: | 160 case cvox.AbstractHost.State.KILLED: |
161 cvox.ChromeVox.isActive = false; | 161 cvox.ChromeVox.isActive = false; |
162 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); | 162 cvox.ChromeVox.navigationManager.showOrHideIndicator(false); |
163 break; | 163 break; |
164 } | 164 } |
165 }; | 165 }; |
OLD | NEW |