Chromium Code Reviews| 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 /** | 5 /** |
| 6 * @type {string} | 6 * @type {string} |
| 7 * @const | 7 * @const |
| 8 */ | 8 */ |
| 9 var SRT_DOWNLOAD_PAGE = 'https://www.google.com/chrome/cleanup-tool/'; | 9 var SRT_DOWNLOAD_PAGE = 'https://www.google.com/chrome/cleanup-tool/'; |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 /** @type {string} | 44 /** @type {string} |
| 45 * @const | 45 * @const |
| 46 */ | 46 */ |
| 47 var SYSINFO_WINDOW_ID = 'sysinfo_window'; | 47 var SYSINFO_WINDOW_ID = 'sysinfo_window'; |
| 48 | 48 |
| 49 /** @type {string} | 49 /** @type {string} |
| 50 * @const | 50 * @const |
| 51 */ | 51 */ |
| 52 var STATS_WINDOW_ID = 'stats_window'; | 52 var STATS_WINDOW_ID = 'stats_window'; |
| 53 | 53 |
| 54 /** @type {string} | |
| 55 * @const | |
| 56 */ | |
| 57 var ANONYMOUS_USER_OPTION_VALUE = 'anonymous_user'; | |
|
xiyuan
2017/03/02 18:55:11
nit: not used?
afakhry
2017/03/02 19:04:47
Yes, not anymore, forgot to remove it. Done.
| |
| 58 | |
| 54 /** | 59 /** |
| 55 * SRT Prompt Result defined in feedback_private.idl. | 60 * SRT Prompt Result defined in feedback_private.idl. |
| 56 * @enum {string} | 61 * @enum {string} |
| 57 */ | 62 */ |
| 58 var SrtPromptResult = { | 63 var SrtPromptResult = { |
| 59 ACCEPTED: 'accepted', // User accepted prompt. | 64 ACCEPTED: 'accepted', // User accepted prompt. |
| 60 DECLINED: 'declined', // User declined prompt. | 65 DECLINED: 'declined', // User declined prompt. |
| 61 CLOSED: 'closed', // User closed window without responding to prompt. | 66 CLOSED: 'closed', // User closed window without responding to prompt. |
| 62 }; | 67 }; |
| 63 | 68 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // Prevent double clicking from sending additional reports. | 164 // Prevent double clicking from sending additional reports. |
| 160 $('send-report-button').disabled = true; | 165 $('send-report-button').disabled = true; |
| 161 console.log('Feedback: Sending report'); | 166 console.log('Feedback: Sending report'); |
| 162 if (!feedbackInfo.attachedFile && attachedFileBlob) { | 167 if (!feedbackInfo.attachedFile && attachedFileBlob) { |
| 163 feedbackInfo.attachedFile = { name: $('attach-file').value, | 168 feedbackInfo.attachedFile = { name: $('attach-file').value, |
| 164 data: attachedFileBlob }; | 169 data: attachedFileBlob }; |
| 165 } | 170 } |
| 166 | 171 |
| 167 feedbackInfo.description = $('description-text').value; | 172 feedbackInfo.description = $('description-text').value; |
| 168 feedbackInfo.pageUrl = $('page-url-text').value; | 173 feedbackInfo.pageUrl = $('page-url-text').value; |
| 169 feedbackInfo.email = $('user-email-text').value; | 174 var emailDropDown = $('user-email-drop-down'); |
| 175 feedbackInfo.email = emailDropDown.options[emailDropDown.selectedIndex].value; | |
|
xiyuan
2017/03/02 18:55:11
nit: get rid of |emailDropDown| and use $('user-em
afakhry
2017/03/02 19:04:47
The line would be too long, but done anyway.
| |
| 170 | 176 |
| 171 var useSystemInfo = false; | 177 var useSystemInfo = false; |
| 172 var useHistograms = false; | 178 var useHistograms = false; |
| 173 if ($('sys-info-checkbox') != null && | 179 if ($('sys-info-checkbox') != null && |
| 174 $('sys-info-checkbox').checked) { | 180 $('sys-info-checkbox').checked) { |
| 175 // Send histograms along with system info. | 181 // Send histograms along with system info. |
| 176 useSystemInfo = useHistograms = true; | 182 useSystemInfo = useHistograms = true; |
| 177 } | 183 } |
| 178 // <if expr="chromeos"> | 184 // <if expr="chromeos"> |
| 179 if ($('performance-info-checkbox') == null || | 185 if ($('performance-info-checkbox') == null || |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 337 chrome.app.window.current().show(); | 343 chrome.app.window.current().show(); |
| 338 | 344 |
| 339 var screenshotDataUrl = screenshotCanvas.toDataURL('image/png'); | 345 var screenshotDataUrl = screenshotCanvas.toDataURL('image/png'); |
| 340 $('screenshot-image').src = screenshotDataUrl; | 346 $('screenshot-image').src = screenshotDataUrl; |
| 341 $('screenshot-image').classList.toggle('wide-screen', | 347 $('screenshot-image').classList.toggle('wide-screen', |
| 342 $('screenshot-image').width > MAX_SCREENSHOT_WIDTH); | 348 $('screenshot-image').width > MAX_SCREENSHOT_WIDTH); |
| 343 feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl); | 349 feedbackInfo.screenshot = dataUrlToBlob(screenshotDataUrl); |
| 344 }); | 350 }); |
| 345 | 351 |
| 346 chrome.feedbackPrivate.getUserEmail(function(email) { | 352 chrome.feedbackPrivate.getUserEmail(function(email) { |
| 347 $('user-email-text').value = email; | 353 var optionElement = document.createElement('option'); |
| 354 optionElement.value = email; | |
| 355 optionElement.text = email; | |
| 356 optionElement.selected = true; | |
| 357 var dropDown = $('user-email-drop-down'); | |
| 358 // Make sure the "Report anonymously" option comes last. | |
| 359 dropDown.insertBefore(optionElement, dropDown.firstChild); | |
|
xiyuan
2017/03/02 18:55:11
nit: get rid of |dropDown|
afakhry
2017/03/02 19:04:47
Done.
| |
| 348 }); | 360 }); |
| 349 | 361 |
| 350 // Initiate getting the system info. | 362 // Initiate getting the system info. |
| 351 isSystemInfoReady = false; | 363 isSystemInfoReady = false; |
| 352 getSystemInformation(onSystemInformation); | 364 getSystemInformation(onSystemInformation); |
| 353 | 365 |
| 354 // An extension called us with an attached file. | 366 // An extension called us with an attached file. |
| 355 if (feedbackInfo.attachedFile) { | 367 if (feedbackInfo.attachedFile) { |
| 356 $('attached-filename-text').textContent = | 368 $('attached-filename-text').textContent = |
| 357 feedbackInfo.attachedFile.name; | 369 feedbackInfo.attachedFile.name; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 $('cancel-button').onclick = cancel; | 450 $('cancel-button').onclick = cancel; |
| 439 $('remove-attached-file').onclick = clearAttachedFile; | 451 $('remove-attached-file').onclick = clearAttachedFile; |
| 440 // <if expr="chromeos"> | 452 // <if expr="chromeos"> |
| 441 $('performance-info-checkbox').addEventListener( | 453 $('performance-info-checkbox').addEventListener( |
| 442 'change', performanceFeedbackChanged); | 454 'change', performanceFeedbackChanged); |
| 443 // </if> | 455 // </if> |
| 444 }); | 456 }); |
| 445 } | 457 } |
| 446 | 458 |
| 447 initialize(); | 459 initialize(); |
| OLD | NEW |