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

Side by Side Diff: chrome/browser/feedback/feedback_util.cc

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/feedback/feedback_util.h" 5 #include "chrome/browser/feedback/feedback_util.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 248
249 bool ZipString(const base::FilePath& filename, 249 bool ZipString(const base::FilePath& filename,
250 const std::string& data, std::string* compressed_logs) { 250 const std::string& data, std::string* compressed_logs) {
251 base::FilePath temp_path; 251 base::FilePath temp_path;
252 base::FilePath zip_file; 252 base::FilePath zip_file;
253 253
254 // Create a temporary directory, put the logs into a file in it. Create 254 // Create a temporary directory, put the logs into a file in it. Create
255 // another temporary file to receive the zip file in. 255 // another temporary file to receive the zip file in.
256 if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path)) 256 if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path))
257 return false; 257 return false;
258 if (file_util::WriteFile(temp_path.Append(filename), 258 if (base::WriteFile(temp_path.Append(filename), data.c_str(), data.size()) ==
259 data.c_str(), data.size()) == -1) 259 -1)
260 return false; 260 return false;
261 261
262 bool succeed = base::CreateTemporaryFile(&zip_file) && 262 bool succeed = base::CreateTemporaryFile(&zip_file) &&
263 zip::Zip(temp_path, zip_file, false) && 263 zip::Zip(temp_path, zip_file, false) &&
264 base::ReadFileToString(zip_file, compressed_logs); 264 base::ReadFileToString(zip_file, compressed_logs);
265 265
266 base::DeleteFile(temp_path, true); 266 base::DeleteFile(temp_path, true);
267 base::DeleteFile(zip_file, false); 267 base::DeleteFile(zip_file, false);
268 268
269 return succeed; 269 return succeed;
270 } 270 }
271 271
272 } // namespace feedback_util 272 } // namespace feedback_util
OLDNEW
« no previous file with comments | « chrome/browser/extensions/user_script_master_unittest.cc ('k') | chrome/browser/first_run/first_run.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698