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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 * Dictionary of constants (initialized by browser). 6 * Dictionary of constants (initialized by browser).
7 */ 7 */
8 var LogEntryType = null; 8 var LogEntryType = null;
9 var LogEventType = null; 9 var LogEventType = null;
10 var LogEventPhase = null; 10 var LogEventPhase = null;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 "proxyCurrentConfig", 48 "proxyCurrentConfig",
49 "proxyReloadSettings", 49 "proxyReloadSettings",
50 "badProxiesTableBody", 50 "badProxiesTableBody",
51 "clearBadProxies"); 51 "clearBadProxies");
52 52
53 // Create a view which lets you tab between the different sub-views. 53 // Create a view which lets you tab between the different sub-views.
54 var categoryTabSwitcher = 54 var categoryTabSwitcher =
55 new TabSwitcherView(new DivView('categoryTabHandles')); 55 new TabSwitcherView(new DivView('categoryTabHandles'));
56 56
57 // Populate the main tabs. 57 // Populate the main tabs.
58 categoryTabSwitcher.addTab('requestsTab', requestsView); 58 categoryTabSwitcher.addTab('requestsTab', requestsView, false);
59 categoryTabSwitcher.addTab('proxyTab', proxyView); 59 categoryTabSwitcher.addTab('proxyTab', proxyView, false);
60 categoryTabSwitcher.addTab('dnsTab', new DivView('dnsTabContent')); 60 categoryTabSwitcher.addTab('dnsTab', new DivView('dnsTabContent'), false);
61 categoryTabSwitcher.addTab('socketsTab', new DivView('socketsTabContent')); 61 categoryTabSwitcher.addTab('socketsTab', new DivView('socketsTabContent'),
62 false);
62 categoryTabSwitcher.addTab('httpCacheTab', 63 categoryTabSwitcher.addTab('httpCacheTab',
63 new DivView('httpCacheTabContent')); 64 new DivView('httpCacheTabContent'), false);
64 65
65 // Select the requests tab as the default. 66 // Build a map from the anchor name of each tab handle to its "tab ID".
66 categoryTabSwitcher.switchToTab('requestsTab'); 67 // We will consider navigations to the #hash as a switch tab request.
68 var anchorMap = {};
69 var tabIds = categoryTabSwitcher.getAllTabIds();
70 for (var i = 0; i < tabIds.length; ++i) {
71 var aNode = document.getElementById(tabIds[i]);
72 anchorMap[aNode.hash] = tabIds[i];
73 }
74 // Default the empty hash to the requests tab.
75 anchorMap['#'] = anchorMap[''] = 'requestsTab';
76
77 window.onhashchange = function() {
78 var tabId = anchorMap[window.location.hash];
79 if (tabId)
80 categoryTabSwitcher.switchToTab(tabId);
81 };
67 82
68 // Make this category tab widget the primary view, that fills the whole page. 83 // Make this category tab widget the primary view, that fills the whole page.
69 var windowView = new WindowView(categoryTabSwitcher); 84 var windowView = new WindowView(categoryTabSwitcher);
70 85
71 // Trigger initial layout. 86 // Trigger initial layout.
72 windowView.resetGeometry(); 87 windowView.resetGeometry();
73 88
89 // Select the initial view based on the current URL.
90 window.onhashchange();
91
74 // Tell the browser that we are ready to start receiving log events. 92 // Tell the browser that we are ready to start receiving log events.
75 g_browser.sendReady(); 93 g_browser.sendReady();
76 } 94 }
77 95
78 /** 96 /**
79 * This class provides a "bridge" for communicating between the javascript and 97 * This class provides a "bridge" for communicating between the javascript and
80 * the browser. 98 * the browser.
81 * 99 *
82 * @constructor 100 * @constructor
83 */ 101 */
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // If the data hasn't changed since last time, no need to notify observers. 260 // If the data hasn't changed since last time, no need to notify observers.
243 if (prevData && JSON.stringify(prevData) == JSON.stringify(data)) 261 if (prevData && JSON.stringify(prevData) == JSON.stringify(data))
244 return; 262 return;
245 263
246 this.prevPollData_[method] = data; 264 this.prevPollData_[method] = data;
247 265
248 // Ok, notify the observers of the change. 266 // Ok, notify the observers of the change.
249 for (var i = 0; i < observerList.length; ++i) 267 for (var i = 0; i < observerList.length; ++i)
250 observerList[i][method](data); 268 observerList[i][method](data);
251 }; 269 };
OLDNEW
« 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