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

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

Issue 179963002: New Zip::ZipFromMemory API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixup! New Zip::ZipFromMemory API. Created 6 years, 10 months 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/feedback/feedback_util.cc
diff --git a/chrome/browser/feedback/feedback_util.cc b/chrome/browser/feedback/feedback_util.cc
index 4b33f648f0bb6b499565a8e3d4f0e652a120077f..dd64c14fabae1a208aa88ec23715dc4d092c3c93 100644
--- a/chrome/browser/feedback/feedback_util.cc
+++ b/chrome/browser/feedback/feedback_util.cc
@@ -248,22 +248,16 @@ 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.
- if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path))
- return false;
- if (file_util::WriteFile(temp_path.Append(filename),
- data.c_str(), data.size()) == -1)
- return false;
+ zip::ZipContents contents_to_zip;
+ contents_to_zip[filename] =
+ new base::RefCountedStaticMemory(data.data(), data.size());
bool succeed = base::CreateTemporaryFile(&zip_file) &&
- zip::Zip(temp_path, zip_file, false) &&
+ zip::ZipFromMemory(zip_file, contents_to_zip, false) &&
base::ReadFileToString(zip_file, compressed_logs);
- base::DeleteFile(temp_path, true);
base::DeleteFile(zip_file, false);
return succeed;

Powered by Google App Engine
This is Rietveld 408576698