summaryrefslogtreecommitdiffstats
path: root/chrome/browser/feedback/feedback_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/feedback/feedback_util.cc')
-rw-r--r--chrome/browser/feedback/feedback_util.cc21
1 files changed, 15 insertions, 6 deletions
diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc
index f738e32..c9346e1 100644
--- a/chrome/browser/feedback/feedback_util.cc
+++ b/chrome/browser/feedback/feedback_util.cc
@@ -374,24 +374,33 @@ void SendReport(scoped_refptr<FeedbackData> data) {
bool ZipString(const base::FilePath& filename,
const std::string& data, std::string* compressed_logs) {
base::FilePath temp_path;
- base::FilePath zip_file;
- // Create a temporary directory, put the logs into a file in it. Create
- // another temporary file to receive the zip file in.
+ // Create a temporary directory, put the logs into a file in it.
if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path))
return false;
- if (file_util::WriteFile(temp_path.Append(filename),
- data.c_str(), data.size()) == -1)
+
+ base::FilePath temp_file = temp_path.Append(filename);
+ if (file_util::WriteFile(temp_file, data.c_str(), data.size()) == -1)
return false;
+
+ return ZipFile(temp_file, compressed_logs);
+}
+
+bool ZipFile(const base::FilePath& filename, std::string* compressed_logs) {
+ base::FilePath zip_file;
+
+ // Create a temporary file to receive the zip file in it.
if (!base::CreateTemporaryFile(&zip_file))
return false;
- if (!zip::Zip(temp_path, zip_file, false))
+ if (!zip::Zip(filename, zip_file, false))
return false;
if (!base::ReadFileToString(zip_file, compressed_logs))
return false;
+ base::DeleteFile(zip_file, false);
+
return true;
}