Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Side by Side Diff: chrome/browser/resources/feedback/js/feedback.js

Issue 2826753002: Fix a bug of black area on window close (Closed)
Patch Set: Write handling in one function to reduce coupling factor Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/resources/feedback/js/topbar_handlers.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 scheduleWindowClose();
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 scheduleWindowClose();
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 function onSystemInformation() { 274 function onSystemInformation() {
275 isSystemInfoReady = true; 275 isSystemInfoReady = true;
276 // In case the sys_info_page needs to be notified by this event, do so. 276 // In case the sys_info_page needs to be notified by this event, do so.
277 if (sysInfoPageOnSysInfoReadyCallback != null) { 277 if (sysInfoPageOnSysInfoReadyCallback != null) {
278 sysInfoPageOnSysInfoReadyCallback(feedbackInfo.systemInformation); 278 sysInfoPageOnSysInfoReadyCallback(feedbackInfo.systemInformation);
279 sysInfoPageOnSysInfoReadyCallback = null; 279 sysInfoPageOnSysInfoReadyCallback = null;
280 } 280 }
281 } 281 }
282 282
283 /** 283 /**
284 * Close the window after 100ms delay.
285 */
286 function scheduleWindowClose() {
287 setTimeout(function() { window.close();}, 100);
288 }
289
290 /**
284 * Initializes our page. 291 * Initializes our page.
285 * Flow: 292 * Flow:
286 * .) DOMContent Loaded -> . Request feedbackInfo object 293 * .) DOMContent Loaded -> . Request feedbackInfo object
287 * . Setup page event handlers 294 * . Setup page event handlers
288 * .) Feedback Object Received -> . take screenshot 295 * .) Feedback Object Received -> . take screenshot
289 * . request email 296 * . request email
290 * . request System info 297 * . request System info
291 * . request i18n strings 298 * . request i18n strings
292 * .) Screenshot taken -> . Show Feedback window. 299 * .) Screenshot taken -> . Show Feedback window.
293 */ 300 */
(...skipping 11 matching lines...) Expand all
305 $('srt-decline-button').onclick = function() { 312 $('srt-decline-button').onclick = function() {
306 isShowingSrtPrompt = false; 313 isShowingSrtPrompt = false;
307 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED); 314 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED);
308 $('srt-prompt').hidden = true; 315 $('srt-prompt').hidden = true;
309 $('content-pane').hidden = false; 316 $('content-pane').hidden = false;
310 }; 317 };
311 318
312 $('srt-accept-button').onclick = function() { 319 $('srt-accept-button').onclick = function() {
313 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.ACCEPTED); 320 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.ACCEPTED);
314 window.open(SRT_DOWNLOAD_PAGE, '_blank'); 321 window.open(SRT_DOWNLOAD_PAGE, '_blank');
315 window.close(); 322 scheduleWindowClose();
316 }; 323 };
317 324
318 $('close-button').addEventListener('click', function() { 325 $('close-button').addEventListener('click', function() {
319 if (isShowingSrtPrompt) { 326 if (isShowingSrtPrompt) {
320 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.CLOSED); 327 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.CLOSED);
321 } 328 }
322 }); 329 });
323 } else { 330 } else {
324 $('srt-prompt').hidden = true; 331 $('srt-prompt').hidden = true;
325 } 332 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 $('cancel-button').onclick = cancel; 454 $('cancel-button').onclick = cancel;
448 $('remove-attached-file').onclick = clearAttachedFile; 455 $('remove-attached-file').onclick = clearAttachedFile;
449 // <if expr="chromeos"> 456 // <if expr="chromeos">
450 $('performance-info-checkbox').addEventListener( 457 $('performance-info-checkbox').addEventListener(
451 'change', performanceFeedbackChanged); 458 'change', performanceFeedbackChanged);
452 // </if> 459 // </if>
453 }); 460 });
454 } 461 }
455 462
456 initialize(); 463 initialize();
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/feedback/js/topbar_handlers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698