| 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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 * Flow: | 237 * Flow: |
| 238 * .) DOMContent Loaded -> . Request feedbackInfo object | 238 * .) DOMContent Loaded -> . Request feedbackInfo object |
| 239 * . Setup page event handlers | 239 * . Setup page event handlers |
| 240 * .) Feedback Object Received -> . take screenshot | 240 * .) Feedback Object Received -> . take screenshot |
| 241 * . request email | 241 * . request email |
| 242 * . request System info | 242 * . request System info |
| 243 * . request i18n strings | 243 * . request i18n strings |
| 244 * .) Screenshot taken -> . Show Feedback window. | 244 * .) Screenshot taken -> . Show Feedback window. |
| 245 */ | 245 */ |
| 246 function initialize() { | 246 function initialize() { |
| 247 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | |
| 248 console.log('FEEDBACK_DEBUG: feedback.js: initialize()'); | |
| 249 | |
| 250 // Add listener to receive the feedback info object. | 247 // Add listener to receive the feedback info object. |
| 251 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | 248 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { |
| 252 if (request.sentFromEventPage) { | 249 if (request.sentFromEventPage) { |
| 253 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | |
| 254 console.log('FEEDBACK_DEBUG: Received feedbackInfo.'); | |
| 255 feedbackInfo = request.data; | 250 feedbackInfo = request.data; |
| 256 $('description-text').textContent = feedbackInfo.description; | 251 $('description-text').textContent = feedbackInfo.description; |
| 257 if (feedbackInfo.pageUrl) | 252 if (feedbackInfo.pageUrl) |
| 258 $('page-url-text').value = feedbackInfo.pageUrl; | 253 $('page-url-text').value = feedbackInfo.pageUrl; |
| 259 | 254 |
| 260 takeScreenshot(function(screenshotCanvas) { | 255 takeScreenshot(function(screenshotCanvas) { |
| 261 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | |
| 262 console.log('FEEDBACK_DEBUG: Taken screenshot. Showing window.'); | |
| 263 | |
| 264 // We've taken our screenshot, show the feedback page without any | 256 // We've taken our screenshot, show the feedback page without any |
| 265 // further delay. | 257 // further delay. |
| 266 window.webkitRequestAnimationFrame(function() { | 258 window.webkitRequestAnimationFrame(function() { |
| 267 resizeAppWindow(); | 259 resizeAppWindow(); |
| 268 }); | 260 }); |
| 269 chrome.app.window.current().show(); | 261 chrome.app.window.current().show(); |
| 270 | 262 |
| 271 var screenshotDataUrl = screenshotCanvas.toDataURL('image/png'); | 263 var screenshotDataUrl = screenshotCanvas.toDataURL('image/png'); |
| 272 $('screenshot-image').src = screenshotDataUrl; | 264 $('screenshot-image').src = screenshotDataUrl; |
| 273 $('screenshot-image').classList.toggle('wide-screen', | 265 $('screenshot-image').classList.toggle('wide-screen', |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 if ($('histograms-url')) { | 305 if ($('histograms-url')) { |
| 314 // Opens a new window showing the histogram metrics. | 306 // Opens a new window showing the histogram metrics. |
| 315 $('histograms-url').onclick = | 307 $('histograms-url').onclick = |
| 316 windowOpener(STATS_WINDOW_ID, 'chrome://histograms'); | 308 windowOpener(STATS_WINDOW_ID, 'chrome://histograms'); |
| 317 } | 309 } |
| 318 }); | 310 }); |
| 319 } | 311 } |
| 320 }); | 312 }); |
| 321 | 313 |
| 322 window.addEventListener('DOMContentLoaded', function() { | 314 window.addEventListener('DOMContentLoaded', function() { |
| 323 // TODO(rkc): Remove logging once crbug.com/284662 is closed. | |
| 324 console.log('FEEDBACK_DEBUG: feedback.js: DOMContentLoaded'); | |
| 325 // Ready to receive the feedback object. | 315 // Ready to receive the feedback object. |
| 326 chrome.runtime.sendMessage({ready: true}); | 316 chrome.runtime.sendMessage({ready: true}); |
| 327 | 317 |
| 328 // Setup our event handlers. | 318 // Setup our event handlers. |
| 329 $('attach-file').addEventListener('change', onFileSelected); | 319 $('attach-file').addEventListener('change', onFileSelected); |
| 330 $('send-report-button').onclick = sendReport; | 320 $('send-report-button').onclick = sendReport; |
| 331 $('cancel-button').onclick = cancel; | 321 $('cancel-button').onclick = cancel; |
| 332 $('remove-attached-file').onclick = clearAttachedFile; | 322 $('remove-attached-file').onclick = clearAttachedFile; |
| 333 <if expr="chromeos"> | 323 <if expr="chromeos"> |
| 334 $('performance-info-checkbox').addEventListener( | 324 $('performance-info-checkbox').addEventListener( |
| 335 'change', performanceFeedbackChanged); | 325 'change', performanceFeedbackChanged); |
| 336 </if> | 326 </if> |
| 337 }); | 327 }); |
| 338 } | 328 } |
| 339 | 329 |
| 340 initialize(); | 330 initialize(); |
| OLD | NEW |