OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Constants. | 5 // Constants. |
6 /** @const */ var FEEDBACK_LANDING_PAGE = | 6 /** @const */ var FEEDBACK_LANDING_PAGE = |
7 'https://www.google.com/support/chrome/go/feedback_confirmation'; | 7 'https://www.google.com/support/chrome/go/feedback_confirmation'; |
8 /** @const */ var MAX_ATTACH_FILE_SIZE = 3 * 1024 * 1024; | 8 /** @const */ var MAX_ATTACH_FILE_SIZE = 3 * 1024 * 1024; |
9 | 9 |
10 var selectedThumbnailDivId = ''; | 10 var selectedThumbnailDivId = ''; |
11 var selectedThumbnailId = ''; | 11 var selectedThumbnailId = ''; |
12 var selectedImageUrl; | 12 var selectedImageUrl; |
13 | 13 |
14 var savedThumbnailIds = []; | 14 var savedThumbnailIds = []; |
15 savedThumbnailIds['current-screenshots'] = ''; | 15 savedThumbnailIds['current-screenshots'] = ''; |
16 savedThumbnailIds['saved-screenshots'] = ''; | 16 savedThumbnailIds['saved-screenshots'] = ''; |
17 | 17 |
18 var categoryTag = ''; | 18 var categoryTag = ''; |
19 var filePath = ''; | 19 var filePath = ''; |
20 var forceDisableScreenshots = false; | 20 var forceDisableScreenshots = false; |
21 var traceId = 0; | |
21 | 22 |
22 // Globals to manage reading data from the attach a file option. | 23 // Globals to manage reading data from the attach a file option. |
23 var attachFileBinaryData = ''; | 24 var attachFileBinaryData = ''; |
24 var lastReader = null; | 25 var lastReader = null; |
25 | 26 |
26 /** | 27 /** |
27 * Returns the base filename for a given path. Handles only Unix style paths. | 28 * Returns the base filename for a given path. Handles only Unix style paths. |
28 * @param {string} path The path to return the basename for. | 29 * @param {string} path The path to return the basename for. |
29 * @return {string} Basename for the path. | 30 * @return {string} Basename for the path. |
30 */ | 31 */ |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 | 178 |
178 var reportArray = [pageUrl, | 179 var reportArray = [pageUrl, |
179 categoryTag, | 180 categoryTag, |
180 $('description-text').value, | 181 $('description-text').value, |
181 userEmail, | 182 userEmail, |
182 imagePath]; | 183 imagePath]; |
183 | 184 |
184 // Add chromeos data if it exists. | 185 // Add chromeos data if it exists. |
185 if ($('sys-info-checkbox')) { | 186 if ($('sys-info-checkbox')) { |
186 reportArray = reportArray.concat([String($('sys-info-checkbox').checked)]); | 187 reportArray = reportArray.concat([String($('sys-info-checkbox').checked)]); |
188 console.log(traceId); | |
rkc
2013/08/09 21:15:44
Do we want this log? If so, might want to prepend
Zachary Kuznia
2013/08/09 21:45:28
Leftover debugging. Removed.
| |
189 if (!$('performance-info-checkbox').checked) { | |
190 traceId = 0; | |
191 } | |
192 reportArray = reportArray.concat([String(traceId)]); | |
187 } | 193 } |
188 | 194 |
189 if ($('attach-file-checkbox') && | 195 if ($('attach-file-checkbox') && |
190 $('attach-file-checkbox').checked) { | 196 $('attach-file-checkbox').checked) { |
191 if (attachFileBinaryData) { | 197 if (attachFileBinaryData) { |
192 reportArray = reportArray.concat( | 198 reportArray = reportArray.concat( |
193 [$('attach-file').files[0].name, btoa(attachFileBinaryData)]); | 199 [$('attach-file').files[0].name, btoa(attachFileBinaryData)]); |
194 } | 200 } |
195 } else if ($('attach-file-custom-checkbox') && | 201 } else if ($('attach-file-custom-checkbox') && |
196 $('attach-file-custom-checkbox').checked) { | 202 $('attach-file-custom-checkbox').checked) { |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
297 $('send-report-button').onclick = sendReport; | 303 $('send-report-button').onclick = sendReport; |
298 $('cancel-button').onclick = cancel; | 304 $('cancel-button').onclick = cancel; |
299 | 305 |
300 // Set default values for the possible parameters, and then parse the actual | 306 // Set default values for the possible parameters, and then parse the actual |
301 // values from the URL href. | 307 // values from the URL href. |
302 var parameters = { | 308 var parameters = { |
303 'description': '', | 309 'description': '', |
304 'categoryTag': '', | 310 'categoryTag': '', |
305 'customPageUrl': '', | 311 'customPageUrl': '', |
306 'filePath': '', | 312 'filePath': '', |
313 <if expr="pp_ifdef('chromeos')"> | |
rkc
2013/08/09 21:15:44
We don't need the <if expr.. here, having the extr
Zachary Kuznia
2013/08/09 21:45:28
Done.
| |
314 'traceId': 0, | |
315 </if> | |
307 }; | 316 }; |
308 | 317 |
309 var loc = window.location; | 318 var loc = window.location; |
310 // Split the query string into an array of parameters. | 319 // Split the query string into an array of parameters. |
311 var query = loc.search.substr(1).split('&'); | 320 var query = loc.search.substr(1).split('&'); |
312 // If we have a query in the hash. | 321 // If we have a query in the hash. |
313 if (loc.hash.indexOf('?') >= 0) { | 322 if (loc.hash.indexOf('?') >= 0) { |
314 // Remove the hash and split this query into parameters too. | 323 // Remove the hash and split this query into parameters too. |
315 query = query.concat(loc.hash.substr(loc.hash.indexOf('?') + 1).split('&')); | 324 query = query.concat(loc.hash.substr(loc.hash.indexOf('?') + 1).split('&')); |
316 } | 325 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
350 $('attach-file-custom-container').hidden = false; | 359 $('attach-file-custom-container').hidden = false; |
351 // No screenshots if we're being invoked by an extension - screenshot was | 360 // No screenshots if we're being invoked by an extension - screenshot was |
352 // never taken. | 361 // never taken. |
353 $('screenshot-checkbox').checked = false; | 362 $('screenshot-checkbox').checked = false; |
354 forceDisableScreenshots = true; | 363 forceDisableScreenshots = true; |
355 } else { | 364 } else { |
356 filePath = ''; | 365 filePath = ''; |
357 } | 366 } |
358 } | 367 } |
359 | 368 |
369 <if expr="pp_ifdef('chromeos')"> | |
rkc
2013/08/09 21:15:44
Same, we can leave this code in non-chromeOS also.
Zachary Kuznia
2013/08/09 21:45:28
Done.
| |
370 traceId = parameters['traceId']; | |
371 console.log(traceId); | |
rkc
2013/08/09 21:15:44
Same as above, either prepend a description to the
Zachary Kuznia
2013/08/09 21:45:28
Done.
| |
372 if (traceId != 0) { | |
373 $('performance-info-area').hidden = false; | |
374 } | |
375 </if> | |
376 | |
360 chrome.send('getDialogDefaults'); | 377 chrome.send('getDialogDefaults'); |
361 chrome.send('refreshCurrentScreenshot'); | 378 chrome.send('refreshCurrentScreenshot'); |
362 } | 379 } |
363 | 380 |
364 function setupCurrentScreenshot(screenshot) { | 381 function setupCurrentScreenshot(screenshot) { |
365 addScreenshot('current-screenshots', screenshot); | 382 addScreenshot('current-screenshots', screenshot); |
366 } | 383 } |
367 | 384 |
368 function setupSavedScreenshots(screenshots) { | 385 function setupSavedScreenshots(screenshots) { |
369 if (screenshots.length == 0) { | 386 if (screenshots.length == 0) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
404 | 421 |
405 if (!defaults.disableScreenshots) | 422 if (!defaults.disableScreenshots) |
406 enableScreenshots(); | 423 enableScreenshots(); |
407 | 424 |
408 if (defaults.useSaved) { | 425 if (defaults.useSaved) { |
409 $('screenshot-link-tosaved').hidden = false; | 426 $('screenshot-link-tosaved').hidden = false; |
410 } | 427 } |
411 } | 428 } |
412 | 429 |
413 window.addEventListener('DOMContentLoaded', load); | 430 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |