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

Unified Diff: chrome/browser/feedback/feedback_util.cc

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
« no previous file with comments | « chrome/browser/feedback/feedback_data.cc ('k') | chrome/browser/resources/feedback.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/feedback/feedback_util.cc
diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc
index 43b13df8aa0a012813983ca35130da884549b965..ace8c39a2018276e299f7f5e1c8d0cd073882a78 100644
--- a/chrome/browser/feedback/feedback_util.cc
+++ b/chrome/browser/feedback/feedback_util.cc
@@ -92,6 +92,7 @@ const int64 kRetryDelayIncreaseFactor = 2;
const int64 kRetryDelayLimit = 14400000; // 4 hours
const char kArbitraryMimeType[] = "application/octet-stream";
+const char kHistogramsAttachmentName[] = "histograms.zip";
const char kLogsAttachmentName[] = "system_logs.zip";
#if defined(OS_CHROMEOS)
@@ -217,6 +218,20 @@ void AddFeedbackData(userfeedback::ExtensionSubmit* feedback_data,
*(web_data->add_product_specific_data()) = log_value;
}
+// Adds data as an attachment to feedback_data if the data is non-empty.
+void AddAttachment(userfeedback::ExtensionSubmit* feedback_data,
+ const char* name,
+ std::string* data) {
+ if (data == NULL || data->empty())
+ return;
+
+ userfeedback::ProductSpecificBinaryData* attachment =
+ feedback_data->add_product_specific_binary_data();
+ attachment->set_mime_type(kArbitraryMimeType);
+ attachment->set_name(name);
+ attachment->set_data(*data);
+}
+
} // namespace
namespace chrome {
@@ -288,27 +303,21 @@ void SendReport(scoped_refptr<FeedbackData> data) {
AddFeedbackData(&feedback_data, i->first, i->second);
}
- if (data->compressed_logs() && data->compressed_logs()->size()) {
- userfeedback::ProductSpecificBinaryData attachment;
- attachment.set_mime_type(kArbitraryMimeType);
- attachment.set_name(kLogsAttachmentName);
- attachment.set_data(*(data->compressed_logs()));
- *(feedback_data.add_product_specific_binary_data()) = attachment;
- }
+ AddAttachment(&feedback_data, kLogsAttachmentName, data->compressed_logs());
+ }
+
+ if (data->histograms()) {
+ AddAttachment(&feedback_data,
+ kHistogramsAttachmentName,
+ data->compressed_histograms());
}
- if (!data->attached_filename().empty() &&
- data->attached_filedata() &&
- !data->attached_filedata()->empty()) {
- userfeedback::ProductSpecificBinaryData attached_file;
- attached_file.set_mime_type(kArbitraryMimeType);
+ if (!data->attached_filename().empty()) {
// We need to use the UTF8Unsafe methods here to accomodate Windows, which
// uses wide strings to store filepaths.
std::string name = base::FilePath::FromUTF8Unsafe(
data->attached_filename()).BaseName().AsUTF8Unsafe();
- attached_file.set_name(name);
- attached_file.set_data(*data->attached_filedata());
- *(feedback_data.add_product_specific_binary_data()) = attached_file;
+ AddAttachment(&feedback_data, name.c_str(), data->attached_filedata());
}
// NOTE: Screenshot needs to be processed after system info since we'll get
« no previous file with comments | « chrome/browser/feedback/feedback_data.cc ('k') | chrome/browser/resources/feedback.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698