Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2255)

Unified Diff: chrome/browser/resources/feedback/js/feedback.js

Issue 55363003: Send compressed histograms with system logs when sending feedback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase with grt's changes Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 9e39158dd40effa5c1020c75810ec900bc301934..72318461f7d7c9dbad1a432116fc1b604d71af0f 100644
--- a/chrome/browser/resources/feedback/js/feedback.js
+++ b/chrome/browser/resources/feedback/js/feedback.js
@@ -23,7 +23,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.
@@ -63,17 +64,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});
+ }
+ };
}
/**
@@ -112,13 +119,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)) {
@@ -145,6 +154,8 @@ function sendReport() {
}
}
+ feedbackInfo.sendHistograms = useHistograms;
+
// If the user doesn't want to send the screenshot.
if (!$('screenshot-checkbox').checked)
feedbackInfo.screenshot = null;
@@ -278,6 +289,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');
+ }
});
}
});
@@ -299,12 +321,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;
- }
});
}
« no previous file with comments | « chrome/browser/resources/feedback/html/default.html ('k') | chrome/common/extensions/api/feedback_private.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698