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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 if (width < FEEDBACK_MIN_WIDTH) | 253 if (width < FEEDBACK_MIN_WIDTH) |
254 width = FEEDBACK_MIN_WIDTH; | 254 width = FEEDBACK_MIN_WIDTH; |
255 | 255 |
256 // We get the height by adding the titlebar height and the content height + | 256 // We get the height by adding the titlebar height and the content height + |
257 // margins. We can't get the margins for the content-pane here by using | 257 // margins. We can't get the margins for the content-pane here by using |
258 // style.margin - the variable seems to not exist. | 258 // style.margin - the variable seems to not exist. |
259 var height = $('title-bar').scrollHeight + | 259 var height = $('title-bar').scrollHeight + |
260 $('content-pane').scrollHeight + CONTENT_MARGIN_HEIGHT; | 260 $('content-pane').scrollHeight + CONTENT_MARGIN_HEIGHT; |
261 | 261 |
262 var minHeight = FEEDBACK_MIN_HEIGHT; | 262 var minHeight = FEEDBACK_MIN_HEIGHT; |
263 if (feedbackInfo.flow == FeedbackFlow.LOGIN) | 263 if (feedbackInfo.flow == chrome.feedbackPrivate.FeedbackFlow.LOGIN) |
264 minHeight = FEEDBACK_MIN_HEIGHT_LOGIN; | 264 minHeight = FEEDBACK_MIN_HEIGHT_LOGIN; |
265 height = Math.max(height, minHeight); | 265 height = Math.max(height, minHeight); |
266 | 266 |
267 chrome.app.window.current().resizeTo(width, height); | 267 chrome.app.window.current().resizeTo(width, height); |
268 } | 268 } |
269 | 269 |
270 /** | 270 /** |
271 * A callback to be invoked when the background page of this extension receives | 271 * A callback to be invoked when the background page of this extension receives |
272 * the system information. | 272 * the system information. |
273 */ | 273 */ |
(...skipping 22 matching lines...) Expand all Loading... |
296 * . request email | 296 * . request email |
297 * . request System info | 297 * . request System info |
298 * . request i18n strings | 298 * . request i18n strings |
299 * .) Screenshot taken -> . Show Feedback window. | 299 * .) Screenshot taken -> . Show Feedback window. |
300 */ | 300 */ |
301 function initialize() { | 301 function initialize() { |
302 // Add listener to receive the feedback info object. | 302 // Add listener to receive the feedback info object. |
303 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { | 303 chrome.runtime.onMessage.addListener(function(request, sender, sendResponse) { |
304 if (request.sentFromEventPage) { | 304 if (request.sentFromEventPage) { |
305 if (!feedbackInfo.flow) | 305 if (!feedbackInfo.flow) |
306 feedbackInfo.flow = FeedbackFlow.REGULAR; | 306 feedbackInfo.flow = chrome.feedbackPrivate.FeedbackFlow.REGULAR; |
307 | 307 |
308 if (feedbackInfo.flow == FeedbackFlow.SHOW_SRT_PROMPT) { | 308 if (feedbackInfo.flow == |
| 309 chrome.feedbackPrivate.FeedbackFlow.SHOW_SRT_PROMPT) { |
309 isShowingSrtPrompt = true; | 310 isShowingSrtPrompt = true; |
310 $('content-pane').hidden = true; | 311 $('content-pane').hidden = true; |
311 | 312 |
312 $('srt-decline-button').onclick = function() { | 313 $('srt-decline-button').onclick = function() { |
313 isShowingSrtPrompt = false; | 314 isShowingSrtPrompt = false; |
314 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED); | 315 chrome.feedbackPrivate.logSrtPromptResult(SrtPromptResult.DECLINED); |
315 $('srt-prompt').hidden = true; | 316 $('srt-prompt').hidden = true; |
316 $('content-pane').hidden = false; | 317 $('content-pane').hidden = false; |
317 }; | 318 }; |
318 | 319 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // An extension called us with an attached file. | 374 // An extension called us with an attached file. |
374 if (feedbackInfo.attachedFile) { | 375 if (feedbackInfo.attachedFile) { |
375 $('attached-filename-text').textContent = | 376 $('attached-filename-text').textContent = |
376 feedbackInfo.attachedFile.name; | 377 feedbackInfo.attachedFile.name; |
377 attachedFileBlob = feedbackInfo.attachedFile.data; | 378 attachedFileBlob = feedbackInfo.attachedFile.data; |
378 $('custom-file-container').hidden = false; | 379 $('custom-file-container').hidden = false; |
379 $('attach-file').hidden = true; | 380 $('attach-file').hidden = true; |
380 } | 381 } |
381 | 382 |
382 // No URL and file attachment for login screen feedback. | 383 // No URL and file attachment for login screen feedback. |
383 if (feedbackInfo.flow == FeedbackFlow.LOGIN) { | 384 if (feedbackInfo.flow == chrome.feedbackPrivate.FeedbackFlow.LOGIN) { |
384 $('page-url').hidden = true; | 385 $('page-url').hidden = true; |
385 $('attach-file-container').hidden = true; | 386 $('attach-file-container').hidden = true; |
386 $('attach-file-note').hidden = true; | 387 $('attach-file-note').hidden = true; |
387 } | 388 } |
388 | 389 |
389 // <if expr="chromeos"> | 390 // <if expr="chromeos"> |
390 if (feedbackInfo.traceId && ($('performance-info-area'))) { | 391 if (feedbackInfo.traceId && ($('performance-info-area'))) { |
391 $('performance-info-area').hidden = false; | 392 $('performance-info-area').hidden = false; |
392 $('performance-info-checkbox').checked = true; | 393 $('performance-info-checkbox').checked = true; |
393 performanceFeedbackChanged(); | 394 performanceFeedbackChanged(); |
394 $('performance-info-link').onclick = openSlowTraceWindow; | 395 $('performance-info-link').onclick = openSlowTraceWindow; |
395 } | 396 } |
396 // </if> | 397 // </if> |
397 chrome.feedbackPrivate.getStrings(function(strings) { | 398 chrome.feedbackPrivate.getStrings(feedbackInfo.flow, function(strings) { |
398 loadTimeData.data = strings; | 399 loadTimeData.data = strings; |
399 i18nTemplate.process(document, loadTimeData); | 400 i18nTemplate.process(document, loadTimeData); |
400 | 401 |
401 if ($('sys-info-url')) { | 402 if ($('sys-info-url')) { |
402 // Opens a new window showing the full anonymized system+app | 403 // Opens a new window showing the full anonymized system+app |
403 // information. | 404 // information. |
404 $('sys-info-url').onclick = function() { | 405 $('sys-info-url').onclick = function() { |
405 var win = chrome.app.window.get(SYSINFO_WINDOW_ID); | 406 var win = chrome.app.window.get(SYSINFO_WINDOW_ID); |
406 if (win) { | 407 if (win) { |
407 win.show(); | 408 win.show(); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 $('cancel-button').onclick = cancel; | 458 $('cancel-button').onclick = cancel; |
458 $('remove-attached-file').onclick = clearAttachedFile; | 459 $('remove-attached-file').onclick = clearAttachedFile; |
459 // <if expr="chromeos"> | 460 // <if expr="chromeos"> |
460 $('performance-info-checkbox').addEventListener( | 461 $('performance-info-checkbox').addEventListener( |
461 'change', performanceFeedbackChanged); | 462 'change', performanceFeedbackChanged); |
462 // </if> | 463 // </if> |
463 }); | 464 }); |
464 } | 465 } |
465 | 466 |
466 initialize(); | 467 initialize(); |
OLD | NEW |