| Index: chrome/browser/resources/feedback/js/feedback.js
|
| diff --git a/chrome/browser/resources/feedback/js/feedback.js b/chrome/browser/resources/feedback/js/feedback.js
|
| index ef2adc416302b33c0f50adc4c4a4efcb7f7c62fa..0a1e345b0e2f14c833d912055b97011455d1f172 100644
|
| --- a/chrome/browser/resources/feedback/js/feedback.js
|
| +++ b/chrome/browser/resources/feedback/js/feedback.js
|
| @@ -18,7 +18,8 @@ var lastReader = null;
|
| var feedbackInfo = null;
|
| var systemInfo = null;
|
|
|
| -var systemInfoWindowId = 0;
|
| +var systemInfoWindow = {id: 0};
|
| +var histogramsWindow = {id: 0};
|
|
|
| /**
|
| * Reads the selected file when the user selects a file.
|
| @@ -58,17 +59,23 @@ function clearAttachedFile() {
|
| }
|
|
|
| /**
|
| - * Opens a new window with chrome://system, showing the current system info.
|
| + * Creates and shows a window with the given url, if the window is not already
|
| + * open.
|
| + * @param {Object} window An object with the id of the window to update, or 0.
|
| + * @param {string} url The destination URL of the new window.
|
| + * @return {function()} A function to be called to open the window.
|
| */
|
| -function openSystemInfoWindow() {
|
| - if (systemInfoWindowId == 0) {
|
| - chrome.windows.create({url: 'chrome://system'}, function(win) {
|
| - systemInfoWindowId = win.id;
|
| - chrome.app.window.current().show();
|
| - });
|
| - } else {
|
| - chrome.windows.update(systemInfoWindowId, {drawAttention: true});
|
| - }
|
| +function windowOpener(window, url) {
|
| + return function() {
|
| + if (window.id == 0) {
|
| + chrome.windows.create({url: url}, function(win) {
|
| + window.id = win.id;
|
| + chrome.app.window.current().show();
|
| + });
|
| + } else {
|
| + chrome.windows.update(window.id, {drawAttention: true});
|
| + }
|
| + };
|
| }
|
|
|
| /**
|
| @@ -107,13 +114,15 @@ function sendReport() {
|
| feedbackInfo.email = $('user-email-text').value;
|
|
|
| var useSystemInfo = false;
|
| + var useHistograms = false;
|
| // On ChromeOS, since we gather System info, check if the user has given his
|
| // permission for us to send system info.
|
| <if expr="pp_ifdef('chromeos')">
|
| if ($('sys-info-checkbox') != null &&
|
| $('sys-info-checkbox').checked &&
|
| systemInfo != null) {
|
| - useSystemInfo = true;
|
| + // Send histograms along with system info.
|
| + useSystemInfo = useHistograms = true;
|
| }
|
| if ($('performance-info-checkbox') == null ||
|
| !($('performance-info-checkbox').checked)) {
|
| @@ -140,6 +149,8 @@ function sendReport() {
|
| }
|
| }
|
|
|
| + feedbackInfo.sendHistograms = useHistograms;
|
| +
|
| // If the user doesn't want to send the screenshot.
|
| if (!$('screenshot-checkbox').checked)
|
| feedbackInfo.screenshot = null;
|
| @@ -260,6 +271,17 @@ function initialize() {
|
| chrome.feedbackPrivate.getStrings(function(strings) {
|
| loadTimeData.data = strings;
|
| i18nTemplate.process(document, loadTimeData);
|
| +
|
| + if ($('sys-info-url')) {
|
| + // Opens a new window showing the current system info.
|
| + $('sys-info-url').onclick =
|
| + windowOpener(systemInfoWindow, 'chrome://system');
|
| + }
|
| + if ($('histograms-url')) {
|
| + // Opens a new window showing the histogram metrics.
|
| + $('histograms-url').onclick =
|
| + windowOpener(histogramsWindow, 'chrome://histograms');
|
| + }
|
| });
|
| }
|
| });
|
| @@ -281,12 +303,11 @@ function initialize() {
|
| </if>
|
|
|
| chrome.windows.onRemoved.addListener(function(windowId, removeInfo) {
|
| - if (windowId == systemInfoWindowId)
|
| - systemInfoWindowId = 0;
|
| + if (windowId == systemInfoWindow.id)
|
| + systemInfoWindow.id = 0;
|
| + else if (windowId == histogramsWindow.id)
|
| + histogramsWindow.id = 0;
|
| });
|
| - if ($('sysinfo-url')) {
|
| - $('sysinfo-url').onclick = openSystemInfoWindow;
|
| - }
|
| });
|
| }
|
|
|
|
|