OLD | NEW |
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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 feedback_data.SerializeToString(post_body); | 369 feedback_data.SerializeToString(post_body); |
370 | 370 |
371 DispatchFeedback(data->profile(), post_body, 0); | 371 DispatchFeedback(data->profile(), post_body, 0); |
372 } | 372 } |
373 | 373 |
374 bool ZipString(const base::FilePath& filename, | 374 bool ZipString(const base::FilePath& filename, |
375 const std::string& data, std::string* compressed_logs) { | 375 const std::string& data, std::string* compressed_logs) { |
376 base::FilePath temp_path; | 376 base::FilePath temp_path; |
377 | 377 |
378 // Create a temporary directory, put the logs into a file in it. | 378 // Create a temporary directory, put the logs into a file in it. |
379 if (!file_util::CreateNewTempDirectory(FILE_PATH_LITERAL(""), &temp_path)) | 379 if (!base::CreateNewTempDirectory(base::FilePath::StringType(), &temp_path)) |
380 return false; | 380 return false; |
381 | 381 |
382 base::FilePath temp_file = temp_path.Append(filename); | 382 base::FilePath temp_file = temp_path.Append(filename); |
383 if (file_util::WriteFile(temp_file, data.c_str(), data.size()) == -1) | 383 if (file_util::WriteFile(temp_file, data.c_str(), data.size()) == -1) |
384 return false; | 384 return false; |
385 | 385 |
386 return ZipFile(temp_file, compressed_logs); | 386 return ZipFile(temp_file, compressed_logs); |
387 } | 387 } |
388 | 388 |
389 bool ZipFile(const base::FilePath& filename, std::string* compressed_logs) { | 389 bool ZipFile(const base::FilePath& filename, std::string* compressed_logs) { |
390 base::FilePath zip_file; | 390 base::FilePath zip_file; |
391 | 391 |
392 // Create a temporary file to receive the zip file in it. | 392 // Create a temporary file to receive the zip file in it. |
393 if (!file_util::CreateTemporaryFile(&zip_file)) | 393 if (!base::CreateTemporaryFile(&zip_file)) |
394 return false; | 394 return false; |
395 | 395 |
396 if (!zip::Zip(filename, zip_file, false)) | 396 if (!zip::Zip(filename, zip_file, false)) |
397 return false; | 397 return false; |
398 | 398 |
399 if (!base::ReadFileToString(zip_file, compressed_logs)) | 399 if (!base::ReadFileToString(zip_file, compressed_logs)) |
400 return false; | 400 return false; |
401 | 401 |
402 base::DeleteFile(zip_file, false); | 402 base::DeleteFile(zip_file, false); |
403 | 403 |
404 return true; | 404 return true; |
405 } | 405 } |
406 | 406 |
407 } // namespace feedback_util | 407 } // namespace feedback_util |
OLD | NEW |