Chromium Code Reviews| Index: chrome/browser/resources/net_internals/main.js |
| =================================================================== |
| --- chrome/browser/resources/net_internals/main.js (revision 109671) |
| +++ chrome/browser/resources/net_internals/main.js (working copy) |
| @@ -44,14 +44,15 @@ |
| function MainView() { |
| assertFirstConstructorCall(MainView); |
| - // Tracks if we're viewing a loaded log file, so views can behave |
| - // appropriately. |
| - this.isViewingLoadedLog_ = false; |
| - |
| // This must be initialized before the tabs, so they can register as |
| // observers. |
| g_browser = BrowserBridge.getInstance(); |
| + // This must be the first constants observer, so other constants observers |
| + // can safely use the globals, rather than depending on walking through |
| + // the constants themselves. |
| + g_browser.addConstantsObserver(new ConstantsObserver()); |
| + |
| // This view is a left (resizable) navigation bar. |
| this.categoryTabSwitcher_ = new TabSwitcherView(); |
| var tabs = this.categoryTabSwitcher_; |
| @@ -82,6 +83,8 @@ |
| false, true); |
| tabs.addTab(EventsView.TAB_HANDLE_ID, EventsView.getInstance(), |
| false, true); |
| + tabs.addTab(TimelineView.TAB_HANDLE_ID, TimelineView.getInstance(), |
| + false, true); |
| tabs.addTab(DnsView.TAB_HANDLE_ID, DnsView.getInstance(), |
| false, true); |
| tabs.addTab(SocketsView.TAB_HANDLE_ID, SocketsView.getInstance(), |
| @@ -127,8 +130,6 @@ |
| // Select the initial view based on the current URL. |
| window.onhashchange(); |
| - g_browser.addConstantsObserver(new ConstantsObserver()); |
| - |
| // Tell the browser that we are ready to start receiving log events. |
| g_browser.sendReady(); |
| } |
| @@ -143,6 +144,14 @@ |
| cr.addSingletonGetter(MainView); |
| + // Tracks if we're viewing a loaded log file, so views can behave |
| + // appropriately. Global so safe to call during construction. |
| + var isViewingLoadedLog = false; |
| + |
| + MainView.isViewingLoadedLog = function() { |
| + return isViewingLoadedLog; |
| + } |
|
eroman
2011/11/16 04:03:46
nit: add a semicolon.
mmenke
2011/11/16 18:39:35
Done.
|
| + |
| MainView.prototype = { |
| // Inherit the superclass's methods. |
| __proto__: superClass.prototype, |
| @@ -163,9 +172,9 @@ |
| * @param {String} fileName The name of the log file that has been loaded. |
| */ |
| onLoadLogFile: function(fileName) { |
| - this.isViewingLoadedLog_ = true; |
| + isViewingLoadedLog = true; |
| - // Swap out the status bar to indicate we have loaded from a file. |
| + // Swap out the status bar to indicate we have loaded from a file. |
| setNodeDisplay($(MainView.STATUS_VIEW_FOR_CAPTURE_ID), false); |
| setNodeDisplay($(MainView.STATUS_VIEW_FOR_FILE_ID), true); |
| @@ -177,16 +186,8 @@ |
| g_browser.sourceTracker.setSecurityStripping(false); |
| g_browser.disable(); |
| }, |
| - |
| - /** |
| - * Returns true if we're viewing a loaded log file. |
| - */ |
| - isViewingLoadedLog: function() { |
| - return this.isViewingLoadedLog_; |
| - } |
| }; |
| - |
| /* |
| * Takes the current hash in form of "#tab¶m1=value1¶m2=value2&...". |
| * Puts the parameters in an object, and passes the resulting object to |