OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 cr.define('uber', function() { | 5 cr.define('uber', function() { |
6 var localStrings = new LocalStrings(); | 6 var localStrings = new LocalStrings(); |
7 | 7 |
8 /** | 8 /** |
9 * Options for how web history should be handled. | 9 * Options for how web history should be handled. |
10 */ | 10 */ |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 forwardMouseWheel(e.data.params); | 144 forwardMouseWheel(e.data.params); |
145 else | 145 else |
146 console.error('Received unexpected message', e.data); | 146 console.error('Received unexpected message', e.data); |
147 } | 147 } |
148 | 148 |
149 /** | 149 /** |
150 * Sends the navigation iframe to the background. | 150 * Sends the navigation iframe to the background. |
151 */ | 151 */ |
152 function backgroundNavigation() { | 152 function backgroundNavigation() { |
153 navFrame.classList.add('background'); | 153 navFrame.classList.add('background'); |
154 setNavigationItemTabbing(false); | |
154 } | 155 } |
155 | 156 |
156 /** | 157 /** |
157 * Retrieves the navigation iframe from the background. | 158 * Retrieves the navigation iframe from the background. |
158 */ | 159 */ |
159 function foregroundNavigation() { | 160 function foregroundNavigation() { |
160 navFrame.classList.remove('background'); | 161 navFrame.classList.remove('background'); |
162 setNavigationItemTabbing(true); | |
161 } | 163 } |
162 | 164 |
163 /** | 165 /** |
164 * Enables or disables animated transitions when changing content while | 166 * Enables or disables animated transitions when changing content while |
165 * horizontally scrolled. | 167 * horizontally scrolled. |
166 * @param {boolean} enabled True if enabled, else false to disable. | 168 * @param {boolean} enabled True if enabled, else false to disable. |
167 */ | 169 */ |
168 function setContentChanging(enabled) { | 170 function setContentChanging(enabled) { |
169 navFrame.classList[enabled ? 'add' : 'remove']('changing-content'); | 171 navFrame.classList[enabled ? 'add' : 'remove']('changing-content'); |
170 | 172 |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
323 | 325 |
324 /** | 326 /** |
325 * Forward scroll wheel events to subpages. | 327 * Forward scroll wheel events to subpages. |
326 * @param {Object} params Relevant parameters of wheel event. | 328 * @param {Object} params Relevant parameters of wheel event. |
327 */ | 329 */ |
328 function forwardMouseWheel(params) { | 330 function forwardMouseWheel(params) { |
329 var iframe = getSelectedIframe().querySelector('iframe'); | 331 var iframe = getSelectedIframe().querySelector('iframe'); |
330 uber.invokeMethodOnWindow(iframe.contentWindow, 'mouseWheel', params); | 332 uber.invokeMethodOnWindow(iframe.contentWindow, 'mouseWheel', params); |
331 } | 333 } |
332 | 334 |
335 /** | |
336 * Enables or disables the ability to tab to the navigation items. | |
337 * @param {boolean} enabled If true, enables tabbing; if false, disables it. | |
338 */ | |
339 function setNavigationItemTabbing(enabled) { | |
Evan Stade
2012/05/08 23:51:31
I don't think this function is necessary. Just spl
Kyle Horimoto
2012/05/09 00:02:19
Done.
| |
340 navFrame.firstChild.tabIndex = enabled ? 0 : -1; | |
341 if (enabled) | |
342 navFrame.firstChild.removeAttribute('aria-hidden'); | |
343 else | |
344 navFrame.firstChild.setAttribute('aria-hidden', true); | |
345 } | |
346 | |
333 return { | 347 return { |
334 onLoad: onLoad, | 348 onLoad: onLoad, |
335 onPopHistoryState: onPopHistoryState | 349 onPopHistoryState: onPopHistoryState |
336 }; | 350 }; |
337 }); | 351 }); |
338 | 352 |
339 window.addEventListener('popstate', uber.onPopHistoryState); | 353 window.addEventListener('popstate', uber.onPopHistoryState); |
340 document.addEventListener('DOMContentLoaded', uber.onLoad); | 354 document.addEventListener('DOMContentLoaded', uber.onLoad); |
OLD | NEW |