| 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 /** | 5 /** |
| 6 * Dictionary of constants (Initialized soon after loading by data from browser, | 6 * Dictionary of constants (Initialized soon after loading by data from browser, |
| 7 * updated on load log). The *Types dictionaries map strings to numeric IDs, | 7 * updated on load log). The *Types dictionaries map strings to numeric IDs, |
| 8 * while the *TypeNames are the other way around. | 8 * while the *TypeNames are the other way around. |
| 9 */ | 9 */ |
| 10 var EventType = null; | 10 var EventType = null; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 */ | 122 */ |
| 123 onLoadLog: function(opt_fileName) { | 123 onLoadLog: function(opt_fileName) { |
| 124 isViewingLoadedLog = true; | 124 isViewingLoadedLog = true; |
| 125 | 125 |
| 126 this.stopCapturing(); | 126 this.stopCapturing(); |
| 127 if (opt_fileName != undefined) { | 127 if (opt_fileName != undefined) { |
| 128 // If there's a file name, a log file was loaded, so swap out the status | 128 // If there's a file name, a log file was loaded, so swap out the status |
| 129 // bar to indicate we're no longer capturing events. Also disable | 129 // bar to indicate we're no longer capturing events. Also disable |
| 130 // hiding cookies, so if the log dump has them, they'll be displayed. | 130 // hiding cookies, so if the log dump has them, they'll be displayed. |
| 131 this.topBarView_.switchToSubView('loaded').setFileName(opt_fileName); | 131 this.topBarView_.switchToSubView('loaded').setFileName(opt_fileName); |
| 132 $(ExportView.PRIVACY_STRIPPING_CHECKBOX_ID).checked = false; | |
| 133 SourceTracker.getInstance().setPrivacyStripping(false); | 132 SourceTracker.getInstance().setPrivacyStripping(false); |
| 134 } else { | 133 } else { |
| 135 // Otherwise, the "Stop Capturing" button was presumably pressed. | 134 // Otherwise, the "Stop Capturing" button was presumably pressed. |
| 136 // Don't disable hiding cookies, so created log dumps won't have them, | 135 // Don't disable hiding cookies, so created log dumps won't have them, |
| 137 // unless the user toggles the option. | 136 // unless the user toggles the option. |
| 138 this.topBarView_.switchToSubView('halted'); | 137 this.topBarView_.switchToSubView('halted'); |
| 139 } | 138 } |
| 140 }, | 139 }, |
| 141 | 140 |
| 142 switchToViewOnlyMode: function() { | 141 switchToViewOnlyMode: function() { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 173 |
| 175 this.tabSwitcher_.addTab(tabId, view, tabName, tabHash); | 174 this.tabSwitcher_.addTab(tabId, view, tabName, tabHash); |
| 176 this.tabIdToHash_[tabId] = tabHash; | 175 this.tabIdToHash_[tabId] = tabHash; |
| 177 this.hashToTabId_[tabHash] = tabId; | 176 this.hashToTabId_[tabHash] = tabId; |
| 178 }.bind(this); | 177 }.bind(this); |
| 179 | 178 |
| 180 // Populate the main tabs. Even tabs that don't contain information for | 179 // Populate the main tabs. Even tabs that don't contain information for |
| 181 // the running OS should be created, so they can load log dumps from other | 180 // the running OS should be created, so they can load log dumps from other |
| 182 // OSes. | 181 // OSes. |
| 183 addTab(CaptureView); | 182 addTab(CaptureView); |
| 184 addTab(ExportView); | |
| 185 addTab(ImportView); | 183 addTab(ImportView); |
| 186 addTab(ProxyView); | 184 addTab(ProxyView); |
| 187 addTab(EventsView); | 185 addTab(EventsView); |
| 188 addTab(TimelineView); | 186 addTab(TimelineView); |
| 189 addTab(DnsView); | 187 addTab(DnsView); |
| 190 addTab(SocketsView); | 188 addTab(SocketsView); |
| 191 addTab(AltSvcView); | 189 addTab(AltSvcView); |
| 192 addTab(SpdyView); | 190 addTab(SpdyView); |
| 193 addTab(QuicView); | 191 addTab(QuicView); |
| 194 addTab(SdchView); | 192 addTab(SdchView); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 221 window.location.hash = newTabHash; | 219 window.location.hash = newTabHash; |
| 222 } | 220 } |
| 223 }, | 221 }, |
| 224 | 222 |
| 225 onUrlHashChange_: function() { | 223 onUrlHashChange_: function() { |
| 226 var parsed = parseUrlHash_(window.location.hash); | 224 var parsed = parseUrlHash_(window.location.hash); |
| 227 | 225 |
| 228 if (!parsed) | 226 if (!parsed) |
| 229 return; | 227 return; |
| 230 | 228 |
| 229 if (parsed.tabHash == "#export") { |
| 230 // The #export tab was removed in M60, after having been |
| 231 // deprecated since M58. In case anyone *still* has URLs |
| 232 // bookmarked to this, inform them and redirect. |
| 233 // TODO(eroman): Delete this around M62. |
| 234 parsed.tabHash = undefined; |
| 235 |
| 236 // Done on a setTimeout so it doesn't block the initial |
| 237 // page load (confirm() is synchronous). |
| 238 setTimeout(() => { |
| 239 var navigateToNetExport = confirm( |
| 240 "#export was removed\nDo you want to navigate to " + |
| 241 "chrome://net-export/ instead?"); |
| 242 if (navigateToNetExport) { |
| 243 window.location.href = "chrome://net-export"; |
| 244 return; |
| 245 } |
| 246 }); |
| 247 } |
| 248 |
| 231 if (!parsed.tabHash) { | 249 if (!parsed.tabHash) { |
| 232 // Default to the export tab. | 250 // Default to the events tab. |
| 233 parsed.tabHash = ExportView.TAB_HASH; | 251 parsed.tabHash = EventsView.TAB_HASH; |
| 234 } | 252 } |
| 235 | 253 |
| 236 var tabId = this.hashToTabId_[parsed.tabHash]; | 254 var tabId = this.hashToTabId_[parsed.tabHash]; |
| 237 | 255 |
| 238 if (tabId) { | 256 if (tabId) { |
| 239 this.tabSwitcher_.switchToTab(tabId); | 257 this.tabSwitcher_.switchToTab(tabId); |
| 240 if (parsed.parameters) { | 258 if (parsed.parameters) { |
| 241 var view = this.tabSwitcher_.getTabView(tabId); | 259 var view = this.tabSwitcher_.getTabView(tabId); |
| 242 view.setParameters(parsed.parameters); | 260 view.setParameters(parsed.parameters); |
| 243 } | 261 } |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 * Returns the name for sdchProblemCode. | 406 * Returns the name for sdchProblemCode. |
| 389 * | 407 * |
| 390 * Example: sdchProblemCodeToString(5) should return | 408 * Example: sdchProblemCodeToString(5) should return |
| 391 * "DECODE_BODY_ERROR". | 409 * "DECODE_BODY_ERROR". |
| 392 * @param {number} sdchProblemCode The SDCH problem code. | 410 * @param {number} sdchProblemCode The SDCH problem code. |
| 393 * @return {string} The name of the given problem code. | 411 * @return {string} The name of the given problem code. |
| 394 */ | 412 */ |
| 395 function sdchProblemCodeToString(sdchProblemCode) { | 413 function sdchProblemCodeToString(sdchProblemCode) { |
| 396 return getKeyWithValue(SdchProblemCode, sdchProblemCode); | 414 return getKeyWithValue(SdchProblemCode, sdchProblemCode); |
| 397 } | 415 } |
| OLD | NEW |