| 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://www.google.com/support/chrome/go/feedback_confirmation'; | 9 'https://www.google.com/support/chrome/go/feedback_confirmation'; |
| 10 /** @type {number} | 10 /** @type {number} |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 feedbackInfo.email = $('user-email-text').value; | 133 feedbackInfo.email = $('user-email-text').value; |
| 134 | 134 |
| 135 var useSystemInfo = false; | 135 var useSystemInfo = false; |
| 136 var useHistograms = false; | 136 var useHistograms = false; |
| 137 if ($('sys-info-checkbox') != null && | 137 if ($('sys-info-checkbox') != null && |
| 138 $('sys-info-checkbox').checked && | 138 $('sys-info-checkbox').checked && |
| 139 systemInfo != null) { | 139 systemInfo != null) { |
| 140 // Send histograms along with system info. | 140 // Send histograms along with system info. |
| 141 useSystemInfo = useHistograms = true; | 141 useSystemInfo = useHistograms = true; |
| 142 } | 142 } |
| 143 <if expr="pp_ifdef('chromeos')"> | 143 <if expr="chromeos"> |
| 144 if ($('performance-info-checkbox') == null || | 144 if ($('performance-info-checkbox') == null || |
| 145 !($('performance-info-checkbox').checked)) { | 145 !($('performance-info-checkbox').checked)) { |
| 146 feedbackInfo.traceId = null; | 146 feedbackInfo.traceId = null; |
| 147 } | 147 } |
| 148 </if> | 148 </if> |
| 149 | 149 |
| 150 if (useSystemInfo) { | 150 if (useSystemInfo) { |
| 151 if (feedbackInfo.systemInformation != null) { | 151 if (feedbackInfo.systemInformation != null) { |
| 152 // Concatenate sysinfo if we had any initial system information | 152 // Concatenate sysinfo if we had any initial system information |
| 153 // sent with the feedback request event. | 153 // sent with the feedback request event. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 function dataUrlToBlob(url) { | 189 function dataUrlToBlob(url) { |
| 190 var mimeString = url.split(',')[0].split(':')[1].split(';')[0]; | 190 var mimeString = url.split(',')[0].split(':')[1].split(';')[0]; |
| 191 var data = atob(url.split(',')[1]); | 191 var data = atob(url.split(',')[1]); |
| 192 var dataArray = []; | 192 var dataArray = []; |
| 193 for (var i = 0; i < data.length; ++i) | 193 for (var i = 0; i < data.length; ++i) |
| 194 dataArray.push(data.charCodeAt(i)); | 194 dataArray.push(data.charCodeAt(i)); |
| 195 | 195 |
| 196 return new Blob([new Uint8Array(dataArray)], {type: mimeString}); | 196 return new Blob([new Uint8Array(dataArray)], {type: mimeString}); |
| 197 } | 197 } |
| 198 | 198 |
| 199 <if expr="pp_ifdef('chromeos')"> | 199 <if expr="chromeos"> |
| 200 /** | 200 /** |
| 201 * Update the page when performance feedback state is changed. | 201 * Update the page when performance feedback state is changed. |
| 202 */ | 202 */ |
| 203 function performanceFeedbackChanged() { | 203 function performanceFeedbackChanged() { |
| 204 if ($('performance-info-checkbox').checked) { | 204 if ($('performance-info-checkbox').checked) { |
| 205 $('attach-file').disabled = true; | 205 $('attach-file').disabled = true; |
| 206 $('attach-file').checked = false; | 206 $('attach-file').checked = false; |
| 207 | 207 |
| 208 $('screenshot-checkbox').disabled = true; | 208 $('screenshot-checkbox').disabled = true; |
| 209 $('screenshot-checkbox').checked = false; | 209 $('screenshot-checkbox').checked = false; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 // An extension called us with an attached file. | 285 // An extension called us with an attached file. |
| 286 if (feedbackInfo.attachedFile) { | 286 if (feedbackInfo.attachedFile) { |
| 287 $('attached-filename-text').textContent = | 287 $('attached-filename-text').textContent = |
| 288 feedbackInfo.attachedFile.name; | 288 feedbackInfo.attachedFile.name; |
| 289 attachedFileBlob = feedbackInfo.attachedFile.data; | 289 attachedFileBlob = feedbackInfo.attachedFile.data; |
| 290 $('custom-file-container').hidden = false; | 290 $('custom-file-container').hidden = false; |
| 291 $('attach-file').hidden = true; | 291 $('attach-file').hidden = true; |
| 292 } | 292 } |
| 293 | 293 |
| 294 <if expr="pp_ifdef('chromeos')"> | 294 <if expr="chromeos"> |
| 295 if (feedbackInfo.traceId && ($('performance-info-area'))) { | 295 if (feedbackInfo.traceId && ($('performance-info-area'))) { |
| 296 $('performance-info-area').hidden = false; | 296 $('performance-info-area').hidden = false; |
| 297 $('performance-info-checkbox').checked = true; | 297 $('performance-info-checkbox').checked = true; |
| 298 performanceFeedbackChanged(); | 298 performanceFeedbackChanged(); |
| 299 $('performance-info-link').onclick = openSlowTraceWindow; | 299 $('performance-info-link').onclick = openSlowTraceWindow; |
| 300 } | 300 } |
| 301 </if> | 301 </if> |
| 302 | 302 |
| 303 chrome.feedbackPrivate.getStrings(function(strings) { | 303 chrome.feedbackPrivate.getStrings(function(strings) { |
| 304 loadTimeData.data = strings; | 304 loadTimeData.data = strings; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 322 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | 322 // TODO(rkc): Remove logging once crbug.com/284662 is closed. |
| 323 console.log('FEEDBACK_DEBUG: feedback.js: DOMContentLoaded'); | 323 console.log('FEEDBACK_DEBUG: feedback.js: DOMContentLoaded'); |
| 324 // Ready to receive the feedback object. | 324 // Ready to receive the feedback object. |
| 325 chrome.runtime.sendMessage({ready: true}); | 325 chrome.runtime.sendMessage({ready: true}); |
| 326 | 326 |
| 327 // Setup our event handlers. | 327 // Setup our event handlers. |
| 328 $('attach-file').addEventListener('change', onFileSelected); | 328 $('attach-file').addEventListener('change', onFileSelected); |
| 329 $('send-report-button').onclick = sendReport; | 329 $('send-report-button').onclick = sendReport; |
| 330 $('cancel-button').onclick = cancel; | 330 $('cancel-button').onclick = cancel; |
| 331 $('remove-attached-file').onclick = clearAttachedFile; | 331 $('remove-attached-file').onclick = clearAttachedFile; |
| 332 <if expr="pp_ifdef('chromeos')"> | 332 <if expr="chromeos"> |
| 333 $('performance-info-checkbox').addEventListener( | 333 $('performance-info-checkbox').addEventListener( |
| 334 'change', performanceFeedbackChanged); | 334 'change', performanceFeedbackChanged); |
| 335 </if> | 335 </if> |
| 336 }); | 336 }); |
| 337 } | 337 } |
| 338 | 338 |
| 339 initialize(); | 339 initialize(); |
| OLD | NEW |