| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 * Main entry point called once the page has loaded. | 6 * Main entry point called once the page has loaded. |
| 7 */ | 7 */ |
| 8 function onLoad() { | 8 function onLoad() { |
| 9 NetExportView.getInstance(); | 9 NetExportView.getInstance(); |
| 10 } | 10 } |
| 11 | 11 |
| 12 document.addEventListener('DOMContentLoaded', onLoad); | 12 document.addEventListener('DOMContentLoaded', onLoad); |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * This class handles the presentation of the net-export view. Used as a | 15 * This class handles the presentation of the net-export view. Used as a |
| 16 * singleton. | 16 * singleton. |
| 17 */ | 17 */ |
| 18 var NetExportView = (function() { | 18 var NetExportView = (function() { |
| 19 'use strict'; | 19 'use strict'; |
| 20 | 20 |
| 21 // -------------------------------------------------------------------------- | 21 // -------------------------------------------------------------------------- |
| 22 | 22 |
| 23 var kIdStateDivUninitialized = 'state-uninitialized'; | 23 var kIdStateDivUninitialized = 'state-uninitialized'; |
| 24 var kIdStateDivInitial = 'state-initial'; | 24 var kIdStateDivInitial = 'state-initial'; |
| 25 var kIdStateDivLogging = 'state-logging'; | 25 var kIdStateDivLogging = 'state-logging'; |
| 26 var kIdStateDivStopped = 'state-stopped'; | 26 var kIdStateDivStopped = 'state-stopped'; |
| 27 var kIdStartLoggingButton = 'start-logging'; | 27 var kIdStartLoggingButton = 'start-logging'; |
| 28 var kIdStopLoggingButton = 'stop-logging'; | 28 var kIdStopLoggingButton = 'stop-logging'; |
| 29 var kIdEmailLogButton = 'mobile-email'; | 29 var kIdEmailLogButton = 'mobile-email'; |
| 30 var kIdShowFileButton = 'show-file'; |
| 30 var kIdCaptureModeLogging = 'capture-mode-logging'; | 31 var kIdCaptureModeLogging = 'capture-mode-logging'; |
| 31 var kIdFilePathLogging = 'file-path-logging'; | 32 var kIdFilePathLogging = 'file-path-logging'; |
| 32 var kIdCaptureModeStopped = 'capture-mode-stopped'; | 33 var kIdCaptureModeStopped = 'capture-mode-stopped'; |
| 33 var kIdFilePathStoppedLogging = 'file-path-stopped'; | 34 var kIdFilePathStoppedLogging = 'file-path-stopped'; |
| 34 var kIdStartOverButton = 'startover'; | 35 var kIdStartOverButton = 'startover'; |
| 35 var kIdReadMoreLink = 'privacy-read-more-link'; | 36 var kIdReadMoreLink = 'privacy-read-more-link'; |
| 36 var kIdReadMoreDiv = 'privacy-read-more' | 37 var kIdReadMoreDiv = 'privacy-read-more' |
| 37 | 38 |
| 38 /** | 39 /** |
| 39 * @constructor | 40 * @constructor |
| (...skipping 26 matching lines...) Expand all Loading... |
| 66 }, | 67 }, |
| 67 | 68 |
| 68 /** | 69 /** |
| 69 * Sends NetLog data via email from browser (mobile only). | 70 * Sends NetLog data via email from browser (mobile only). |
| 70 */ | 71 */ |
| 71 onSendEmail_: function() { | 72 onSendEmail_: function() { |
| 72 chrome.send('sendNetLog'); | 73 chrome.send('sendNetLog'); |
| 73 }, | 74 }, |
| 74 | 75 |
| 75 /** | 76 /** |
| 77 * Reveals the log file in the shell (i.e. selects it in the Finder on |
| 78 * Mac). |
| 79 */ |
| 80 onShowFile_: function() { |
| 81 chrome.send('showFile'); |
| 82 }, |
| 83 |
| 84 /** |
| 76 * Transitions back to the "Start logging to disk" state. | 85 * Transitions back to the "Start logging to disk" state. |
| 77 */ | 86 */ |
| 78 onStartOver_: function() { | 87 onStartOver_: function() { |
| 79 this.infoForLoggedFile_ = null; | 88 this.infoForLoggedFile_ = null; |
| 80 this.renderInitial_(); | 89 this.renderInitial_(); |
| 81 }, | 90 }, |
| 82 | 91 |
| 83 /** | 92 /** |
| 84 * Updates the UI to reflect the current state. The state transitions are | 93 * Updates the UI to reflect the current state. The state transitions are |
| 85 * sent by the browser controller (NetLogFileWriter): | 94 * sent by the browser controller (NetLogFileWriter): |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 | 203 |
| 195 /* | 204 /* |
| 196 * Updates the UI to display the state when logging has stopped. | 205 * Updates the UI to display the state when logging has stopped. |
| 197 */ | 206 */ |
| 198 renderStoppedLogging_: function(info) { | 207 renderStoppedLogging_: function(info) { |
| 199 this.showStateDiv_(kIdStateDivStopped); | 208 this.showStateDiv_(kIdStateDivStopped); |
| 200 | 209 |
| 201 // The email button is only available in the mobile UI. | 210 // The email button is only available in the mobile UI. |
| 202 if ($(kIdEmailLogButton)) | 211 if ($(kIdEmailLogButton)) |
| 203 $(kIdEmailLogButton).onclick = this.onSendEmail_.bind(this); | 212 $(kIdEmailLogButton).onclick = this.onSendEmail_.bind(this); |
| 213 // The show file button is only available in the desktop UI. |
| 214 if ($(kIdShowFileButton)) |
| 215 $(kIdShowFileButton).onclick = this.onShowFile_.bind(this); |
| 204 $(kIdStartOverButton).onclick = this.onStartOver_.bind(this); | 216 $(kIdStartOverButton).onclick = this.onStartOver_.bind(this); |
| 205 | 217 |
| 206 $(kIdFilePathStoppedLogging).textContent = info.file; | 218 $(kIdFilePathStoppedLogging).textContent = info.file; |
| 207 | 219 |
| 208 $(kIdCaptureModeStopped).textContent = this.getCaptureModeText_(info); | 220 $(kIdCaptureModeStopped).textContent = this.getCaptureModeText_(info); |
| 209 | 221 |
| 210 // Hook up the "read more..." link for privacy information. | 222 // Hook up the "read more..." link for privacy information. |
| 211 $(kIdReadMoreLink).onclick = this.showPrivacyReadMore_.bind(this, true); | 223 $(kIdReadMoreLink).onclick = this.showPrivacyReadMore_.bind(this, true); |
| 212 this.showPrivacyReadMore_(false); | 224 this.showPrivacyReadMore_(false); |
| 213 }, | 225 }, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 242 ]; | 254 ]; |
| 243 | 255 |
| 244 for (var curDivId of kAllDivIds) { | 256 for (var curDivId of kAllDivIds) { |
| 245 $(curDivId).hidden = divId != curDivId; | 257 $(curDivId).hidden = divId != curDivId; |
| 246 } | 258 } |
| 247 }, | 259 }, |
| 248 }; | 260 }; |
| 249 | 261 |
| 250 return NetExportView; | 262 return NetExportView; |
| 251 })(); | 263 })(); |
| OLD | NEW |