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

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: addressing comments Created 6 years, 9 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..134a2665a9dcfc1912c3b2973e221db660cffe9d 100644
--- a/chrome/browser/feedback/feedback_util.cc
+++ b/chrome/browser/feedback/feedback_util.cc
@@ -46,7 +46,7 @@
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
#include "third_party/icu/source/common/unicode/locid.h"
-#include "third_party/zlib/google/zip.h"
+#include "third_party/zlib/google/zip_writer.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
@@ -248,22 +248,15 @@ 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::ZipWriter writer;
+ writer.AddFile(filename, data);
bool succeed = base::CreateTemporaryFile(&zip_file) &&
- zip::Zip(temp_path, zip_file, false) &&
+ writer.Commit(zip_file, zip::ZipWriter::OverWrite) &&
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