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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 // that value since the API uses an integer value, and a conflict in data | 194 // that value since the API uses an integer value, and a conflict in data |
| 195 // types will cause the report to fail to be sent. | 195 // types will cause the report to fail to be sent. |
| 196 productId = null; | 196 productId = null; |
| 197 } | 197 } |
| 198 feedbackInfo.productId = productId; | 198 feedbackInfo.productId = productId; |
| 199 | 199 |
| 200 // Request sending the report, show the landing page (if allowed), and close | 200 // Request sending the report, show the landing page (if allowed), and close |
| 201 // this window right away. The FeedbackRequest object that represents this | 201 // this window right away. The FeedbackRequest object that represents this |
| 202 // report will take care of sending the report in the background. | 202 // report will take care of sending the report in the background. |
| 203 sendFeedbackReport(useSystemInfo); | 203 sendFeedbackReport(useSystemInfo); |
| 204 window.close(); | 204 setTimeout(function() { window.close();}, 100); |
|
afakhry
2017/04/18 19:07:25
code repetition is not ok. Please create a functio
weidongg
2017/04/18 19:28:55
Done.
| |
| 205 return true; | 205 return true; |
| 206 } | 206 } |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * Click listener for the cancel button. | 209 * Click listener for the cancel button. |
| 210 * @param {Event} e The click event being handled. | 210 * @param {Event} e The click event being handled. |
| 211 */ | 211 */ |
| 212 function cancel(e) { | 212 function cancel(e) { |
| 213 e.preventDefault(); | 213 e.preventDefault(); |
| 214 window.close(); | 214 setTimeout(function() {window.close();}, 100); |
| 215 } | 215 } |
| 216 | 216 |
| 217 /** | 217 /** |
| 218 * Converts a blob data URL to a blob object. | 218 * Converts a blob data URL to a blob object. |
| 219 * @param {string} url The data URL to convert. | 219 * @param {string} url The data URL to convert. |
| 220 * @return {Blob} Blob object containing the data. | 220 * @return {Blob} Blob object containing the data. |
| 221 */ | 221 */ |
| 222 function dataUrlToBlob(url) { | 222 function dataUrlToBlob(url) { |
| 223 var mimeString = url.split(',')[0].split(':')[1].split(';')[0]; | 223 var mimeString = url.split(',')[0].split(':')[1].split(';')[0]; |
| 224 var data = atob(url.split(',')[1]); | 224 var data = atob(url.split(',')[1]); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 $('srt-decline-button').onclick = function() { | 305 $('srt-decline-button').onclick = function() { |
| 306 isShowingSrtPrompt = false; | 306 isShowingSrtPrompt = false; |
| 307 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED); | 307 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED); |
| 308 $('srt-prompt').hidden = true; | 308 $('srt-prompt').hidden = true; |
| 309 $('content-pane').hidden = false; | 309 $('content-pane').hidden = false; |
| 310 }; | 310 }; |
| 311 | 311 |
| 312 $('srt-accept-button').onclick = function() { | 312 $('srt-accept-button').onclick = function() { |
| 313 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.ACCEPTED); | 313 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.ACCEPTED); |
| 314 window.open(SRT_DOWNLOAD_PAGE, '_blank'); | 314 window.open(SRT_DOWNLOAD_PAGE, '_blank'); |
| 315 window.close(); | 315 setTimeout(function() { window.close();}, 100); |
| 316 }; | 316 }; |
| 317 | 317 |
| 318 $('close-button').addEventListener('click', function() { | 318 $('close-button').addEventListener('click', function() { |
| 319 if (isShowingSrtPrompt) { | 319 if (isShowingSrtPrompt) { |
| 320 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.CLOSED); | 320 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.CLOSED); |
| 321 } | 321 } |
| 322 }); | 322 }); |
| 323 } else { | 323 } else { |
| 324 $('srt-prompt').hidden = true; | 324 $('srt-prompt').hidden = true; |
| 325 } | 325 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 447 $('cancel-button').onclick = cancel; | 447 $('cancel-button').onclick = cancel; |
| 448 $('remove-attached-file').onclick = clearAttachedFile; | 448 $('remove-attached-file').onclick = clearAttachedFile; |
| 449 // <if expr="chromeos"> | 449 // <if expr="chromeos"> |
| 450 $('performance-info-checkbox').addEventListener( | 450 $('performance-info-checkbox').addEventListener( |
| 451 'change', performanceFeedbackChanged); | 451 'change', performanceFeedbackChanged); |
| 452 // </if> | 452 // </if> |
| 453 }); | 453 }); |
| 454 } | 454 } |
| 455 | 455 |
| 456 initialize(); | 456 initialize(); |
| OLD | NEW |