| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 <include src="gpu_internals/browser_bridge.js"/> | |
| 6 <include src="gpu_internals/info_view.js"/> | |
| 7 | |
| 8 var browserBridge; | |
| 9 | |
| 10 /** | |
| 11 * Main entry point. called once the page has loaded. | |
| 12 */ | |
| 13 function onLoad() { | |
| 14 browserBridge = new gpu.BrowserBridge(); | |
| 15 | |
| 16 // Create the views. | |
| 17 cr.ui.decorate('#info-view', gpu.InfoView); | |
| 18 | |
| 19 // Create the main tab control | |
| 20 var tabs = $('main-tabs'); | |
| 21 cr.ui.decorate(tabs, cr.ui.TabBox); | |
| 22 | |
| 23 // Sync the main-tabs selectedTabs in-sync with the location. | |
| 24 tabs.addEventListener('selectedChange', function() { | |
| 25 if (tabs.selectedTab.id) { | |
| 26 history.pushState('', '', '#' + tabs.selectedTab.id); | |
| 27 } | |
| 28 }); | |
| 29 window.onhashchange = function() { | |
| 30 var cur = window.location.hash; | |
| 31 if (cur == '#' || cur == '') { | |
| 32 tabs.selectedTab = $('info-view'); | |
| 33 } else { | |
| 34 var tab = $(window.location.hash.substr(1)); | |
| 35 if (tab) | |
| 36 tabs.selectedTab = tab; | |
| 37 } | |
| 38 }; | |
| 39 window.onhashchange(); | |
| 40 } | |
| 41 | |
| 42 document.addEventListener('DOMContentLoaded', onLoad); | |
| OLD | NEW |