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 | 8 |
9 var selectedThumbnailDivId = ''; | 9 var selectedThumbnailDivId = ''; |
10 var selectedThumbnailId = ''; | 10 var selectedThumbnailId = ''; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 alert(loadTimeData.getString('no-description')); | 94 alert(loadTimeData.getString('no-description')); |
95 return false; | 95 return false; |
96 } | 96 } |
97 | 97 |
98 var imagePath = ''; | 98 var imagePath = ''; |
99 if ($('screenshot-checkbox').checked && selectedThumbnailId) | 99 if ($('screenshot-checkbox').checked && selectedThumbnailId) |
100 imagePath = $(selectedThumbnailId + '-image').src; | 100 imagePath = $(selectedThumbnailId + '-image').src; |
101 var pageUrl = $('page-url-text').value; | 101 var pageUrl = $('page-url-text').value; |
102 if (!$('page-url-checkbox').checked) | 102 if (!$('page-url-checkbox').checked) |
103 pageUrl = ''; | 103 pageUrl = ''; |
| 104 var userEmail = $('user-email-text').value; |
| 105 if (!$('user-email-checkbox').checked) |
| 106 userEmail = ''; |
104 | 107 |
105 var reportArray = [pageUrl, | 108 var reportArray = [pageUrl, |
106 categoryTag, | 109 categoryTag, |
107 $('description-text').value, | 110 $('description-text').value, |
| 111 userEmail, |
108 imagePath]; | 112 imagePath]; |
109 | 113 |
110 // Add chromeos data if it exists. | 114 // Add chromeos data if it exists. |
111 if ($('user-email-text') && $('sys-info-checkbox')) { | 115 if ($('sys-info-checkbox')) { |
112 var userEmail = $('user-email-text').textContent; | 116 reportArray = reportArray.concat([String($('sys-info-checkbox').checked)]); |
113 if (!$('user-email-checkbox').checked) | |
114 userEmail = ''; | |
115 reportArray = reportArray.concat([userEmail, | |
116 String($('sys-info-checkbox').checked)]); | |
117 } | 117 } |
118 | 118 |
119 // open the landing page in a new tab, sendReport will close this one. | 119 // open the landing page in a new tab, sendReport will close this one. |
120 window.open(FEEDBACK_LANDING_PAGE, '_blank'); | 120 window.open(FEEDBACK_LANDING_PAGE, '_blank'); |
121 chrome.send('sendReport', reportArray); | 121 chrome.send('sendReport', reportArray); |
122 return true; | 122 return true; |
123 } | 123 } |
124 | 124 |
125 /** | 125 /** |
126 * Click listener for the cancel button. | 126 * Click listener for the cancel button. |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 savedSelected(); | 275 savedSelected(); |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 function setupDialogDefaults(defaults) { | 279 function setupDialogDefaults(defaults) { |
280 // Current url. | 280 // Current url. |
281 if ($('page-url-text').value == '') | 281 if ($('page-url-text').value == '') |
282 $('page-url-text').value = defaults.currentUrl; | 282 $('page-url-text').value = defaults.currentUrl; |
283 if (defaults.currentUrl == '') | 283 if (defaults.currentUrl == '') |
284 $('page-url-checkbox').checked = false; | 284 $('page-url-checkbox').checked = false; |
| 285 // User e-mail. |
| 286 $('user-email-text').value = defaults.userEmail; |
285 | 287 |
286 // Are screenshots disabled? | 288 // Are screenshots disabled? |
287 if (!defaults.disableScreenshots) | 289 if (!defaults.disableScreenshots) |
288 enableScreenshots(); | 290 enableScreenshots(); |
289 | 291 |
290 // User e-mail. | 292 if (defaults.useSaved) { |
291 if ($('user-email-text')) { | 293 $('screenshot-link-tosaved').hidden = false; |
292 // We're in Chromium OS. | |
293 $('user-email-text').textContent = defaults.userEmail; | |
294 if (defaults.userEmail == '') { | |
295 // if we didn't get an e-mail address from cros, | |
296 // disable the user email display totally. | |
297 $('user-email-table').hidden = true; | |
298 | |
299 // this also means we are in privacy mode, so no saved screenshots. | |
300 $('screenshot-link-tosaved').hidden = true; | |
301 } | |
302 } | 294 } |
303 } | 295 } |
304 | 296 |
305 window.addEventListener('DOMContentLoaded', load); | 297 window.addEventListener('DOMContentLoaded', load); |
OLD | NEW |