| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 /** @type {string} | 5 /** @type {string} |
| 6 * @const | 6 * @const |
| 7 */ | 7 */ |
| 8 var FEEDBACK_LANDING_PAGE = | 8 var FEEDBACK_LANDING_PAGE = |
| 9 'https://support.google.com/chrome/go/feedback_confirmation'; | 9 'https://support.google.com/chrome/go/feedback_confirmation'; |
| 10 /** @type {number} | 10 /** @type {number} |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 feedbackInfo.systemInformation.concat(sysInfo); | 252 feedbackInfo.systemInformation.concat(sysInfo); |
| 253 } else { | 253 } else { |
| 254 feedbackInfo.systemInformation = sysInfo; | 254 feedbackInfo.systemInformation = sysInfo; |
| 255 } | 255 } |
| 256 | 256 |
| 257 // In case the sys_info_page needs to be notified by this event, do so. | 257 // In case the sys_info_page needs to be notified by this event, do so. |
| 258 if (sysInfoPageOnSysInfoReadyCallback != null) { | 258 if (sysInfoPageOnSysInfoReadyCallback != null) { |
| 259 sysInfoPageOnSysInfoReadyCallback(feedbackInfo.systemInformation); | 259 sysInfoPageOnSysInfoReadyCallback(feedbackInfo.systemInformation); |
| 260 sysInfoPageOnSysInfoReadyCallback = null; | 260 sysInfoPageOnSysInfoReadyCallback = null; |
| 261 } | 261 } |
| 262 | |
| 263 setOnSystemInfoReadyCallback(null); | |
| 264 } | 262 } |
| 265 | 263 |
| 266 /** | 264 /** |
| 267 * Initializes our page. | 265 * Initializes our page. |
| 268 * Flow: | 266 * Flow: |
| 269 * .) DOMContent Loaded -> . Request feedbackInfo object | 267 * .) DOMContent Loaded -> . Request feedbackInfo object |
| 270 * . Setup page event handlers | 268 * . Setup page event handlers |
| 271 * .) Feedback Object Received -> . take screenshot | 269 * .) Feedback Object Received -> . take screenshot |
| 272 * . request email | 270 * . request email |
| 273 * . request System info | 271 * . request System info |
| (...skipping 21 matching lines...) Expand all Loading... |
| 295 $('screenshot-image').src = screenshotDataUrl; | 293 $('screenshot-image').src = screenshotDataUrl; |
| 296 $('screenshot-image').classList.toggle('wide-screen', | 294 $('screenshot-image').classList.toggle('wide-screen', |
| 297 $('screenshot-image').width > MAX_SCREENSHOT_WIDTH); | 295 $('screenshot-image').width > MAX_SCREENSHOT_WIDTH); |
| 298 feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl); | 296 feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl); |
| 299 }); | 297 }); |
| 300 | 298 |
| 301 chrome.feedbackPrivate.getUserEmail(function(email) { | 299 chrome.feedbackPrivate.getUserEmail(function(email) { |
| 302 $('user-email-text').value = email; | 300 $('user-email-text').value = email; |
| 303 }); | 301 }); |
| 304 | 302 |
| 305 // Prepare the full system information if available or do this later once | 303 // Initiate getting the system info and use it to prepare the full |
| 306 // it becomes available. | 304 // feedback info. |
| 307 if (isSystemInfoReady()) | 305 getSystemInformation(onSystemInformation); |
| 308 onSystemInformation(getSystemInformation()); | |
| 309 else | |
| 310 setOnSystemInfoReadyCallback(onSystemInformation); | |
| 311 | 306 |
| 312 // An extension called us with an attached file. | 307 // An extension called us with an attached file. |
| 313 if (feedbackInfo.attachedFile) { | 308 if (feedbackInfo.attachedFile) { |
| 314 $('attached-filename-text').textContent = | 309 $('attached-filename-text').textContent = |
| 315 feedbackInfo.attachedFile.name; | 310 feedbackInfo.attachedFile.name; |
| 316 attachedFileBlob = feedbackInfo.attachedFile.data; | 311 attachedFileBlob = feedbackInfo.attachedFile.data; |
| 317 $('custom-file-container').hidden = false; | 312 $('custom-file-container').hidden = false; |
| 318 $('attach-file').hidden = true; | 313 $('attach-file').hidden = true; |
| 319 } | 314 } |
| 320 | 315 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 $('cancel-button').onclick = cancel; | 385 $('cancel-button').onclick = cancel; |
| 391 $('remove-attached-file').onclick = clearAttachedFile; | 386 $('remove-attached-file').onclick = clearAttachedFile; |
| 392 <if expr="chromeos"> | 387 <if expr="chromeos"> |
| 393 $('performance-info-checkbox').addEventListener( | 388 $('performance-info-checkbox').addEventListener( |
| 394 'change', performanceFeedbackChanged); | 389 'change', performanceFeedbackChanged); |
| 395 </if> | 390 </if> |
| 396 }); | 391 }); |
| 397 } | 392 } |
| 398 | 393 |
| 399 initialize(); | 394 initialize(); |
| OLD | NEW |