Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2109)

Unified Diff: chrome/browser/resources/net_internals/main.js

Issue 1525016: Make it possible to switch between views of the new net-internals page by usi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix long lines Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/net_internals/main.js
===================================================================
--- chrome/browser/resources/net_internals/main.js (revision 43897)
+++ chrome/browser/resources/net_internals/main.js (working copy)
@@ -55,22 +55,40 @@
new TabSwitcherView(new DivView('categoryTabHandles'));
// Populate the main tabs.
- categoryTabSwitcher.addTab('requestsTab', requestsView);
- categoryTabSwitcher.addTab('proxyTab', proxyView);
- categoryTabSwitcher.addTab('dnsTab', new DivView('dnsTabContent'));
- categoryTabSwitcher.addTab('socketsTab', new DivView('socketsTabContent'));
+ categoryTabSwitcher.addTab('requestsTab', requestsView, false);
+ categoryTabSwitcher.addTab('proxyTab', proxyView, false);
+ categoryTabSwitcher.addTab('dnsTab', new DivView('dnsTabContent'), false);
+ categoryTabSwitcher.addTab('socketsTab', new DivView('socketsTabContent'),
+ false);
categoryTabSwitcher.addTab('httpCacheTab',
- new DivView('httpCacheTabContent'));
+ new DivView('httpCacheTabContent'), false);
- // Select the requests tab as the default.
- categoryTabSwitcher.switchToTab('requestsTab');
+ // Build a map from the anchor name of each tab handle to its "tab ID".
+ // We will consider navigations to the #hash as a switch tab request.
+ var anchorMap = {};
+ var tabIds = categoryTabSwitcher.getAllTabIds();
+ for (var i = 0; i < tabIds.length; ++i) {
+ var aNode = document.getElementById(tabIds[i]);
+ anchorMap[aNode.hash] = tabIds[i];
+ }
+ // Default the empty hash to the requests tab.
+ anchorMap['#'] = anchorMap[''] = 'requestsTab';
+ window.onhashchange = function() {
+ var tabId = anchorMap[window.location.hash];
+ if (tabId)
+ categoryTabSwitcher.switchToTab(tabId);
+ };
+
// Make this category tab widget the primary view, that fills the whole page.
var windowView = new WindowView(categoryTabSwitcher);
// Trigger initial layout.
windowView.resetGeometry();
+ // Select the initial view based on the current URL.
+ window.onhashchange();
+
// Tell the browser that we are ready to start receiving log events.
g_browser.sendReady();
}
« no previous file with comments | « chrome/browser/resources/net_internals/index.html ('k') | chrome/browser/resources/net_internals/tabswitcherview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698